#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,pairll>pairllll;
typedef long double ld;
typedef pair<ll,string>pairls;
#define INF 1000000000000007
#define pb push_back
#define fr first
#define sc second
ll n;
struct D{
ll x,y,r,N;
}d[300007];
bool mcp(D d1, D d2){
if(d1.r!=d2.r)return d1.r>d2.r;
return d1.N<d2.N;
}
void RES(){
ll res[300007];
sort(d+1,d+1+n,mcp);
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
if((d[j].x-d[i].x)*(d[j].x-d[i].x)+(d[j].y-d[i].y)*(d[j].y-d[i].y)<=(d[j].r+d[i].r)*(d[j].r+d[i].r) && (res[d[j].N]==d[j].N || i==j)){
res[d[i].N]=d[j].N;
break;
}
}
}
for(int i=1;i<=n;i++){
cout<<res[i]<<" ";
}
cout<<endl;
return ;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>d[i].x>>d[i].y>>d[i].r;
d[i].N=i;
}
//if(n<=5000){
RES();
return 0;
//}
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 |
2 ms |
2636 KB |
Output is correct |
2 |
Correct |
2 ms |
2636 KB |
Output is correct |
3 |
Correct |
2 ms |
2636 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
2 ms |
2636 KB |
Output is correct |
6 |
Correct |
2 ms |
2636 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
2 ms |
2636 KB |
Output is correct |
9 |
Correct |
2 ms |
2636 KB |
Output is correct |
10 |
Correct |
3 ms |
2636 KB |
Output is correct |
11 |
Correct |
2 ms |
2636 KB |
Output is correct |
12 |
Correct |
2 ms |
2636 KB |
Output is correct |
13 |
Correct |
2 ms |
2636 KB |
Output is correct |
14 |
Correct |
2 ms |
2636 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
4 ms |
2636 KB |
Output is correct |
17 |
Correct |
4 ms |
2636 KB |
Output is correct |
18 |
Correct |
3 ms |
2636 KB |
Output is correct |
19 |
Correct |
12 ms |
2764 KB |
Output is correct |
20 |
Correct |
9 ms |
2764 KB |
Output is correct |
21 |
Correct |
11 ms |
2892 KB |
Output is correct |
22 |
Correct |
29 ms |
2788 KB |
Output is correct |
23 |
Correct |
28 ms |
2792 KB |
Output is correct |
24 |
Correct |
29 ms |
2800 KB |
Output is correct |
25 |
Correct |
28 ms |
2764 KB |
Output is correct |
26 |
Correct |
29 ms |
2824 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3070 ms |
11948 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2636 KB |
Output is correct |
2 |
Execution timed out |
3073 ms |
5660 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3065 ms |
11956 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2636 KB |
Output is correct |
2 |
Correct |
2 ms |
2636 KB |
Output is correct |
3 |
Correct |
2 ms |
2636 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
2 ms |
2636 KB |
Output is correct |
6 |
Correct |
2 ms |
2636 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
2 ms |
2636 KB |
Output is correct |
9 |
Correct |
2 ms |
2636 KB |
Output is correct |
10 |
Correct |
3 ms |
2636 KB |
Output is correct |
11 |
Correct |
2 ms |
2636 KB |
Output is correct |
12 |
Correct |
2 ms |
2636 KB |
Output is correct |
13 |
Correct |
2 ms |
2636 KB |
Output is correct |
14 |
Correct |
2 ms |
2636 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
4 ms |
2636 KB |
Output is correct |
17 |
Correct |
4 ms |
2636 KB |
Output is correct |
18 |
Correct |
3 ms |
2636 KB |
Output is correct |
19 |
Correct |
12 ms |
2764 KB |
Output is correct |
20 |
Correct |
9 ms |
2764 KB |
Output is correct |
21 |
Correct |
11 ms |
2892 KB |
Output is correct |
22 |
Correct |
29 ms |
2788 KB |
Output is correct |
23 |
Correct |
28 ms |
2792 KB |
Output is correct |
24 |
Correct |
29 ms |
2800 KB |
Output is correct |
25 |
Correct |
28 ms |
2764 KB |
Output is correct |
26 |
Correct |
29 ms |
2824 KB |
Output is correct |
27 |
Correct |
20 ms |
2872 KB |
Output is correct |
28 |
Correct |
18 ms |
3256 KB |
Output is correct |
29 |
Correct |
18 ms |
3272 KB |
Output is correct |
30 |
Correct |
96 ms |
3196 KB |
Output is correct |
31 |
Correct |
98 ms |
3148 KB |
Output is correct |
32 |
Correct |
94 ms |
3220 KB |
Output is correct |
33 |
Correct |
176 ms |
9408 KB |
Output is correct |
34 |
Correct |
170 ms |
9412 KB |
Output is correct |
35 |
Correct |
2327 ms |
9216 KB |
Output is correct |
36 |
Execution timed out |
3050 ms |
8384 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
2636 KB |
Output is correct |
2 |
Correct |
2 ms |
2636 KB |
Output is correct |
3 |
Correct |
2 ms |
2636 KB |
Output is correct |
4 |
Correct |
2 ms |
2636 KB |
Output is correct |
5 |
Correct |
2 ms |
2636 KB |
Output is correct |
6 |
Correct |
2 ms |
2636 KB |
Output is correct |
7 |
Correct |
2 ms |
2636 KB |
Output is correct |
8 |
Correct |
2 ms |
2636 KB |
Output is correct |
9 |
Correct |
2 ms |
2636 KB |
Output is correct |
10 |
Correct |
3 ms |
2636 KB |
Output is correct |
11 |
Correct |
2 ms |
2636 KB |
Output is correct |
12 |
Correct |
2 ms |
2636 KB |
Output is correct |
13 |
Correct |
2 ms |
2636 KB |
Output is correct |
14 |
Correct |
2 ms |
2636 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
4 ms |
2636 KB |
Output is correct |
17 |
Correct |
4 ms |
2636 KB |
Output is correct |
18 |
Correct |
3 ms |
2636 KB |
Output is correct |
19 |
Correct |
12 ms |
2764 KB |
Output is correct |
20 |
Correct |
9 ms |
2764 KB |
Output is correct |
21 |
Correct |
11 ms |
2892 KB |
Output is correct |
22 |
Correct |
29 ms |
2788 KB |
Output is correct |
23 |
Correct |
28 ms |
2792 KB |
Output is correct |
24 |
Correct |
29 ms |
2800 KB |
Output is correct |
25 |
Correct |
28 ms |
2764 KB |
Output is correct |
26 |
Correct |
29 ms |
2824 KB |
Output is correct |
27 |
Execution timed out |
3070 ms |
11948 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |