#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define pii pair<ll,ll>
#define vi vector<int>
#define pb emplace_back
#define fi first
#define se second
#define all(n) (n).begin(),(n).end()
#define mem(n,m) memset(n,m,sizeof(n))
#define IOS ios::sync_with_stdio(0), cin.tie(0)
#define dbg(...) cerr<<#__VA_ARGS__<<" = ";_do(__VA_ARGS__);
template<typename A> void _do(A x){cerr<<x<<'\n';}
template<typename A,typename ...B> void _do(A x,B ...y){cerr<<x<<", ";_do(y...);}
struct circle{
ll x, y, r, id;
bool operator<(const circle &b){
if(r!=b.r) return r>b.r;
return id<b.id;
}
}arr[300005];
int n, del[300005];
bool in(ll i,ll j){
ll R = arr[i].r + arr[j].r;
ll dx = arr[i].x - arr[j].x, dy = arr[i].y - arr[j].y;
return dx*dx + dy*dy <= R*R;
}
signed main(){
IOS;
cin>>n;
for(int i=1;i<=n;i++){
cin>>arr[i].x>>arr[i].y>>arr[i].r;
arr[i].id = i;
}
sort(arr+1,arr+1+n);
for(int i=1;i<=n;i++){
if(del[arr[i].id]) continue;
//dbg(arr[i].id);
for(int j=1;j<=n;j++){
if(del[arr[j].id]) continue;
if(in(i,j)){
del[arr[j].id] = arr[i].id;
}
}
del[arr[i].id] = arr[i].id;
}
for(int i=1;i<=n;i++) cout<<del[i]<<" \n"[i==n];
}
/*
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 |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
512 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
396 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
396 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
640 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
640 KB |
Output is correct |
20 |
Correct |
4 ms |
640 KB |
Output is correct |
21 |
Correct |
4 ms |
640 KB |
Output is correct |
22 |
Correct |
44 ms |
700 KB |
Output is correct |
23 |
Correct |
62 ms |
640 KB |
Output is correct |
24 |
Correct |
53 ms |
712 KB |
Output is correct |
25 |
Correct |
66 ms |
640 KB |
Output is correct |
26 |
Correct |
45 ms |
640 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
197 ms |
19736 KB |
Output is correct |
2 |
Correct |
191 ms |
19656 KB |
Output is correct |
3 |
Correct |
184 ms |
19448 KB |
Output is correct |
4 |
Correct |
188 ms |
19832 KB |
Output is correct |
5 |
Execution timed out |
3065 ms |
15740 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Execution timed out |
3042 ms |
6776 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3017 ms |
13800 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
512 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
396 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
396 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
640 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
640 KB |
Output is correct |
20 |
Correct |
4 ms |
640 KB |
Output is correct |
21 |
Correct |
4 ms |
640 KB |
Output is correct |
22 |
Correct |
44 ms |
700 KB |
Output is correct |
23 |
Correct |
62 ms |
640 KB |
Output is correct |
24 |
Correct |
53 ms |
712 KB |
Output is correct |
25 |
Correct |
66 ms |
640 KB |
Output is correct |
26 |
Correct |
45 ms |
640 KB |
Output is correct |
27 |
Correct |
9 ms |
1024 KB |
Output is correct |
28 |
Correct |
7 ms |
1024 KB |
Output is correct |
29 |
Correct |
11 ms |
1024 KB |
Output is correct |
30 |
Correct |
207 ms |
1016 KB |
Output is correct |
31 |
Correct |
187 ms |
1016 KB |
Output is correct |
32 |
Correct |
226 ms |
1016 KB |
Output is correct |
33 |
Correct |
88 ms |
7544 KB |
Output is correct |
34 |
Correct |
71 ms |
7544 KB |
Output is correct |
35 |
Correct |
87 ms |
7416 KB |
Output is correct |
36 |
Execution timed out |
3068 ms |
6392 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
512 KB |
Output is correct |
4 |
Correct |
1 ms |
384 KB |
Output is correct |
5 |
Correct |
1 ms |
384 KB |
Output is correct |
6 |
Correct |
1 ms |
384 KB |
Output is correct |
7 |
Correct |
1 ms |
396 KB |
Output is correct |
8 |
Correct |
0 ms |
384 KB |
Output is correct |
9 |
Correct |
1 ms |
396 KB |
Output is correct |
10 |
Correct |
1 ms |
384 KB |
Output is correct |
11 |
Correct |
1 ms |
384 KB |
Output is correct |
12 |
Correct |
1 ms |
384 KB |
Output is correct |
13 |
Correct |
1 ms |
384 KB |
Output is correct |
14 |
Correct |
1 ms |
384 KB |
Output is correct |
15 |
Correct |
0 ms |
384 KB |
Output is correct |
16 |
Correct |
1 ms |
640 KB |
Output is correct |
17 |
Correct |
1 ms |
384 KB |
Output is correct |
18 |
Correct |
1 ms |
384 KB |
Output is correct |
19 |
Correct |
4 ms |
640 KB |
Output is correct |
20 |
Correct |
4 ms |
640 KB |
Output is correct |
21 |
Correct |
4 ms |
640 KB |
Output is correct |
22 |
Correct |
44 ms |
700 KB |
Output is correct |
23 |
Correct |
62 ms |
640 KB |
Output is correct |
24 |
Correct |
53 ms |
712 KB |
Output is correct |
25 |
Correct |
66 ms |
640 KB |
Output is correct |
26 |
Correct |
45 ms |
640 KB |
Output is correct |
27 |
Correct |
197 ms |
19736 KB |
Output is correct |
28 |
Correct |
191 ms |
19656 KB |
Output is correct |
29 |
Correct |
184 ms |
19448 KB |
Output is correct |
30 |
Correct |
188 ms |
19832 KB |
Output is correct |
31 |
Execution timed out |
3065 ms |
15740 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |