#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
const int nmax=100005;
pair<int,int> v[nmax];
long long x[nmax],y[nmax],r[nmax];
int tt[nmax];
int n,i,j;
bool ok(int A,int B)
{
return (1LL*(x[A]-x[B])*(x[A]-x[B])+1LL*(y[A]-y[B])*(y[A]-y[B])<=1LL*(r[A]+r[B])*(r[A]+r[B]));
}
bool comp(pair<int,int> unu,pair<int,int> doi)
{
if(unu.first==doi.first) return unu.second<doi.second;
return unu.first>doi.first;
}
int main()
{
//freopen("data.in","r",stdin);
cin>>n;
bool zr=1;
for(i=1;i<=n;i++)
{
cin>>x[i]>>y[i]>>r[i];
v[i].first=r[i];
v[i].second=i;
if(y[i]!=0)
{
zr=0;
}
}
if(n<=5000)
{
sort(v+1,v+n+1,comp);
for(i=1;i<=n;i++)
if(!tt[v[i].second])
{
tt[v[i].second]=v[i].second;
for(j=i+1;j<=n;j++)
{
if(ok(v[i].second,v[j].second)&&(!tt[v[j].second]))
tt[v[j].second]=v[i].second;
}
}
for(i=1;i<=n;i++)
cout<<tt[i]<<' ';
return 0;
}
if(zr)
{
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
412 KB |
Output is correct |
4 |
Correct |
2 ms |
428 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
2 ms |
432 KB |
Output is correct |
7 |
Correct |
2 ms |
432 KB |
Output is correct |
8 |
Correct |
2 ms |
432 KB |
Output is correct |
9 |
Correct |
2 ms |
532 KB |
Output is correct |
10 |
Correct |
3 ms |
532 KB |
Output is correct |
11 |
Correct |
2 ms |
656 KB |
Output is correct |
12 |
Correct |
2 ms |
676 KB |
Output is correct |
13 |
Correct |
2 ms |
676 KB |
Output is correct |
14 |
Correct |
3 ms |
676 KB |
Output is correct |
15 |
Correct |
2 ms |
676 KB |
Output is correct |
16 |
Correct |
4 ms |
676 KB |
Output is correct |
17 |
Correct |
5 ms |
784 KB |
Output is correct |
18 |
Correct |
4 ms |
784 KB |
Output is correct |
19 |
Correct |
11 ms |
1008 KB |
Output is correct |
20 |
Correct |
13 ms |
1304 KB |
Output is correct |
21 |
Correct |
12 ms |
1336 KB |
Output is correct |
22 |
Correct |
47 ms |
1640 KB |
Output is correct |
23 |
Correct |
46 ms |
1800 KB |
Output is correct |
24 |
Correct |
46 ms |
1804 KB |
Output is correct |
25 |
Correct |
61 ms |
2020 KB |
Output is correct |
26 |
Correct |
46 ms |
2072 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
130 ms |
8268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
8268 KB |
Output is correct |
2 |
Incorrect |
157 ms |
8268 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
170 ms |
8268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
412 KB |
Output is correct |
4 |
Correct |
2 ms |
428 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
2 ms |
432 KB |
Output is correct |
7 |
Correct |
2 ms |
432 KB |
Output is correct |
8 |
Correct |
2 ms |
432 KB |
Output is correct |
9 |
Correct |
2 ms |
532 KB |
Output is correct |
10 |
Correct |
3 ms |
532 KB |
Output is correct |
11 |
Correct |
2 ms |
656 KB |
Output is correct |
12 |
Correct |
2 ms |
676 KB |
Output is correct |
13 |
Correct |
2 ms |
676 KB |
Output is correct |
14 |
Correct |
3 ms |
676 KB |
Output is correct |
15 |
Correct |
2 ms |
676 KB |
Output is correct |
16 |
Correct |
4 ms |
676 KB |
Output is correct |
17 |
Correct |
5 ms |
784 KB |
Output is correct |
18 |
Correct |
4 ms |
784 KB |
Output is correct |
19 |
Correct |
11 ms |
1008 KB |
Output is correct |
20 |
Correct |
13 ms |
1304 KB |
Output is correct |
21 |
Correct |
12 ms |
1336 KB |
Output is correct |
22 |
Correct |
47 ms |
1640 KB |
Output is correct |
23 |
Correct |
46 ms |
1800 KB |
Output is correct |
24 |
Correct |
46 ms |
1804 KB |
Output is correct |
25 |
Correct |
61 ms |
2020 KB |
Output is correct |
26 |
Correct |
46 ms |
2072 KB |
Output is correct |
27 |
Incorrect |
29 ms |
8268 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
412 KB |
Output is correct |
4 |
Correct |
2 ms |
428 KB |
Output is correct |
5 |
Correct |
2 ms |
432 KB |
Output is correct |
6 |
Correct |
2 ms |
432 KB |
Output is correct |
7 |
Correct |
2 ms |
432 KB |
Output is correct |
8 |
Correct |
2 ms |
432 KB |
Output is correct |
9 |
Correct |
2 ms |
532 KB |
Output is correct |
10 |
Correct |
3 ms |
532 KB |
Output is correct |
11 |
Correct |
2 ms |
656 KB |
Output is correct |
12 |
Correct |
2 ms |
676 KB |
Output is correct |
13 |
Correct |
2 ms |
676 KB |
Output is correct |
14 |
Correct |
3 ms |
676 KB |
Output is correct |
15 |
Correct |
2 ms |
676 KB |
Output is correct |
16 |
Correct |
4 ms |
676 KB |
Output is correct |
17 |
Correct |
5 ms |
784 KB |
Output is correct |
18 |
Correct |
4 ms |
784 KB |
Output is correct |
19 |
Correct |
11 ms |
1008 KB |
Output is correct |
20 |
Correct |
13 ms |
1304 KB |
Output is correct |
21 |
Correct |
12 ms |
1336 KB |
Output is correct |
22 |
Correct |
47 ms |
1640 KB |
Output is correct |
23 |
Correct |
46 ms |
1800 KB |
Output is correct |
24 |
Correct |
46 ms |
1804 KB |
Output is correct |
25 |
Correct |
61 ms |
2020 KB |
Output is correct |
26 |
Correct |
46 ms |
2072 KB |
Output is correct |
27 |
Runtime error |
130 ms |
8268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |