#include<bits/stdc++.h>
#define endl '\n'
using namespace std;
int n;
pair<long long, int> pr[300005];
long long x[300005], y[300005], r[300005];
int prem[300005];
void print_ans()
{
cout<<prem[1];
for(int j=2; j<=n; j++) cout<<" "<<prem[j];
cout<<endl;
}
void solve1()
{
for(int i1=1; i1<=n; i1++)
{
int i=pr[i1].second;
if(prem[i]) continue;
prem[i]=i;
for(int j1=i1+1; j1<=n; j1++)
{
int j=pr[j1].second;
if(prem[j]) continue;
if((r[i]+r[j])*(r[i]+r[j])<(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])) continue;
prem[j]=i;
}
}
print_ans();
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
cin>>n;
for(int i=1; i<=n; i++) {cin>>x[i]>>y[i]>>r[i]; pr[i]={-r[i], i};}
sort(pr+1, pr+n+1);
if(n<=5000) solve1();
return 0;
}
/**
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8652 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8672 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8672 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Correct |
1 ms |
8540 KB |
Output is correct |
13 |
Correct |
1 ms |
8540 KB |
Output is correct |
14 |
Correct |
1 ms |
8540 KB |
Output is correct |
15 |
Correct |
1 ms |
8540 KB |
Output is correct |
16 |
Correct |
2 ms |
8676 KB |
Output is correct |
17 |
Correct |
1 ms |
8540 KB |
Output is correct |
18 |
Correct |
1 ms |
8540 KB |
Output is correct |
19 |
Correct |
3 ms |
8796 KB |
Output is correct |
20 |
Correct |
3 ms |
8796 KB |
Output is correct |
21 |
Correct |
3 ms |
8796 KB |
Output is correct |
22 |
Correct |
38 ms |
8792 KB |
Output is correct |
23 |
Correct |
32 ms |
8796 KB |
Output is correct |
24 |
Correct |
31 ms |
8804 KB |
Output is correct |
25 |
Correct |
48 ms |
9040 KB |
Output is correct |
26 |
Correct |
31 ms |
8816 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
80 ms |
19916 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8536 KB |
Output is correct |
2 |
Incorrect |
31 ms |
13264 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
71 ms |
21068 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8652 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8672 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8672 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Correct |
1 ms |
8540 KB |
Output is correct |
13 |
Correct |
1 ms |
8540 KB |
Output is correct |
14 |
Correct |
1 ms |
8540 KB |
Output is correct |
15 |
Correct |
1 ms |
8540 KB |
Output is correct |
16 |
Correct |
2 ms |
8676 KB |
Output is correct |
17 |
Correct |
1 ms |
8540 KB |
Output is correct |
18 |
Correct |
1 ms |
8540 KB |
Output is correct |
19 |
Correct |
3 ms |
8796 KB |
Output is correct |
20 |
Correct |
3 ms |
8796 KB |
Output is correct |
21 |
Correct |
3 ms |
8796 KB |
Output is correct |
22 |
Correct |
38 ms |
8792 KB |
Output is correct |
23 |
Correct |
32 ms |
8796 KB |
Output is correct |
24 |
Correct |
31 ms |
8804 KB |
Output is correct |
25 |
Correct |
48 ms |
9040 KB |
Output is correct |
26 |
Correct |
31 ms |
8816 KB |
Output is correct |
27 |
Incorrect |
4 ms |
8792 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
8540 KB |
Output is correct |
2 |
Correct |
1 ms |
8540 KB |
Output is correct |
3 |
Correct |
1 ms |
8652 KB |
Output is correct |
4 |
Correct |
1 ms |
8540 KB |
Output is correct |
5 |
Correct |
1 ms |
8540 KB |
Output is correct |
6 |
Correct |
1 ms |
8540 KB |
Output is correct |
7 |
Correct |
1 ms |
8672 KB |
Output is correct |
8 |
Correct |
1 ms |
8540 KB |
Output is correct |
9 |
Correct |
1 ms |
8540 KB |
Output is correct |
10 |
Correct |
1 ms |
8672 KB |
Output is correct |
11 |
Correct |
1 ms |
8540 KB |
Output is correct |
12 |
Correct |
1 ms |
8540 KB |
Output is correct |
13 |
Correct |
1 ms |
8540 KB |
Output is correct |
14 |
Correct |
1 ms |
8540 KB |
Output is correct |
15 |
Correct |
1 ms |
8540 KB |
Output is correct |
16 |
Correct |
2 ms |
8676 KB |
Output is correct |
17 |
Correct |
1 ms |
8540 KB |
Output is correct |
18 |
Correct |
1 ms |
8540 KB |
Output is correct |
19 |
Correct |
3 ms |
8796 KB |
Output is correct |
20 |
Correct |
3 ms |
8796 KB |
Output is correct |
21 |
Correct |
3 ms |
8796 KB |
Output is correct |
22 |
Correct |
38 ms |
8792 KB |
Output is correct |
23 |
Correct |
32 ms |
8796 KB |
Output is correct |
24 |
Correct |
31 ms |
8804 KB |
Output is correct |
25 |
Correct |
48 ms |
9040 KB |
Output is correct |
26 |
Correct |
31 ms |
8816 KB |
Output is correct |
27 |
Incorrect |
80 ms |
19916 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |