#include <bits/stdc++.h>
using namespace std;
#define int long long
bool inte(vector<int> c,vector<int> c1)
{
int dis=(c[2]-c1[2])*(c[2]-c1[2])+(c[3]-c1[3])*(c[3]-c1[3]);
return dis <= (c[0]+c1[0])*(c[0]+c1[0]);
}
signed main()
{
int n;
cin>>n;
int r[n],x[n],y[n],ans[n]={};
if (n<=5000)
{
set<vector<int>> se;
set<int> rem;
for (int i=0;i<n;i++)
{
cin>>x[i]>>y[i]>>r[i];
se.insert({-r[i],i,x[i],y[i]});
rem.insert(i);
}
while (!se.empty())
{
auto it=se.begin();
vector<int> c=*it;c[0]*=-1;
for (int i:rem)
if (!ans[i] && inte(c,{r[i],i,x[i],y[i]}))
{
se.erase({-r[i],i,x[i],y[i]});
ans[i]=c[1]+1;
}
}
}
else
{
int mx=-1e9,mn=-mx;
for (int i=0;i<n;i++)
cin>>x[i]>>y[i]>>r[i],mn=min(mn,y[i]),mx=max(mx,y[i]);
}
for (int i=0;i<n;i++)
cout<<ans[i]<<' ';
cout<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
436 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
432 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
432 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
448 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
7 ms |
1444 KB |
Output is correct |
20 |
Correct |
6 ms |
1372 KB |
Output is correct |
21 |
Correct |
7 ms |
1368 KB |
Output is correct |
22 |
Correct |
487 ms |
1484 KB |
Output is correct |
23 |
Correct |
441 ms |
1372 KB |
Output is correct |
24 |
Correct |
443 ms |
1496 KB |
Output is correct |
25 |
Correct |
451 ms |
1492 KB |
Output is correct |
26 |
Correct |
465 ms |
1488 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
155 ms |
10324 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Incorrect |
63 ms |
5200 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
181 ms |
10328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
436 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
432 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
432 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
448 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
7 ms |
1444 KB |
Output is correct |
20 |
Correct |
6 ms |
1372 KB |
Output is correct |
21 |
Correct |
7 ms |
1368 KB |
Output is correct |
22 |
Correct |
487 ms |
1484 KB |
Output is correct |
23 |
Correct |
441 ms |
1372 KB |
Output is correct |
24 |
Correct |
443 ms |
1496 KB |
Output is correct |
25 |
Correct |
451 ms |
1492 KB |
Output is correct |
26 |
Correct |
465 ms |
1488 KB |
Output is correct |
27 |
Incorrect |
12 ms |
856 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
436 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
432 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
432 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
2 ms |
600 KB |
Output is correct |
17 |
Correct |
1 ms |
448 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
7 ms |
1444 KB |
Output is correct |
20 |
Correct |
6 ms |
1372 KB |
Output is correct |
21 |
Correct |
7 ms |
1368 KB |
Output is correct |
22 |
Correct |
487 ms |
1484 KB |
Output is correct |
23 |
Correct |
441 ms |
1372 KB |
Output is correct |
24 |
Correct |
443 ms |
1496 KB |
Output is correct |
25 |
Correct |
451 ms |
1492 KB |
Output is correct |
26 |
Correct |
465 ms |
1488 KB |
Output is correct |
27 |
Incorrect |
155 ms |
10324 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |