| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 702994 | Hanksburger | Park (BOI16_park) | C++17 | 353 ms | 50884 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<pair<double, pair<ll, ll> > > vec;
ll x[2005], y[2005], r[2005], par[4005];
pair<pair<ll, ll>, ll> a[100005];
bool ans[100005][5];
ll p(ll u)
{
return par[u]==u?u:(par[u]=p(par[u]));
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
ll n, m, w, h, ind=0;
cin >> n >> m >> w >> h;
for (ll i=1; i<=n; i++)
{
cin >> x[i] >> y[i] >> r[i];
for (ll j=1; j<i; j++)
vec.push_back({sqrt((x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j]))-r[i]-r[j], {i, j}});
vec.push_back({x[i]-r[i], {i, n*2}});
vec.push_back({y[i]-r[i], {i, n*2+1}});
vec.push_back({w-x[i]-r[i], {i, n*2+2}});
vec.push_back({h-y[i]-r[i], {i, n*2+3}});
}
for (ll i=1; i<=m; i++)
{
cin >> a[i].first.first >> a[i].first.second;
a[i].second=i;
}
sort(vec.begin(), vec.end());
sort(a+1, a+m+1);
n*=2;
for (ll i=1; i<=n+3; i++)
par[i]=i;
for (ll i=1; i<=m; i++)
{
while (ind<vec.size() && vec[ind].first<a[i].first.first*2)
{
par[p(vec[ind].second.first)]=p(vec[ind].second.second);
ind++;
}
ll b=a[i].first.second-1, c=a[i].second;
ans[c][b]=1;
ans[c][(b+3)%4]=(p(n+b)!=p(n+(b+1)%4) && p(n+b)!=p(n+(b+2)%4) && p(n+b)!=p(n+(b+3)%4));
ans[c][(b+1)%4]=(p(n+(b+1)%4)!=p(n+b) && p(n+(b+1)%4)!=p(n+(b+2)%4) && p(n+(b+1)%4)!=p(n+(b+3)%4));
ans[c][(b+2)%4]=(p(n+(b+1)%4)!=p(n+b) && p(n+(b+1)%4)!=p(n+(b+3)%4) && p(n+(b+2)%4)!=p(n+b) && p(n+(b+2)%4)!=p(n+(b+3)%4));
}
for (ll i=1; i<=m; i++)
{
for (ll j=0; j<=3; j++)
if (ans[i][j])
cout << j+1;
cout << '\n';
}
}컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
