#include <bits/stdc++.h>
#define pb push_back
#define F first
#define S second
#define endl '\n'
#define ep insert
#define pow pwr
#define sqrt sqrtt
#define elif else if
#define y1 YONE
#define int long long
using namespace std;
struct circle{
int x,y,r,idx;
};
bool cmp(circle x,circle y){
if (x.r!=y.r) return x.r>y.r;
return x.idx<y.idx;
}
int dis(int x1,int y1,int x2,int y2){
return (x1-x2)*(x1-x2)+(y1-y2)*(y1-y2);
}
const int N=1e6+5;
int n,ans[N];
circle a[N];
vector<int> adj[N];
int32_t main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
cin>>n;
for (int i=1;i<=n;i++) {cin>>a[i].x>>a[i].y>>a[i].r;a[i].idx=i;}
sort(a+1,a+1+n,cmp);
for (int i=1;i<=n;i++){
for (int j=1;j<=n;j++){
int x=dis(a[i].x,a[i].y,a[j].x,a[j].y),y=(a[i].r+a[j].r)*(a[i].r+a[j].r);
if (x>y) continue;
adj[i].pb(j);
}
}
for (int i=1;i<=n;i++){
if (ans[a[i].idx]) continue;
for (auto u:adj[i]){
if (ans[a[u].idx]) continue;
ans[a[u].idx]=a[i].idx;
}
}
for (int i=1;i<=n;i++) cout<<ans[i]<<' ';
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23812 KB |
Output is correct |
3 |
Correct |
12 ms |
23764 KB |
Output is correct |
4 |
Correct |
12 ms |
23764 KB |
Output is correct |
5 |
Correct |
12 ms |
23764 KB |
Output is correct |
6 |
Correct |
12 ms |
23884 KB |
Output is correct |
7 |
Correct |
13 ms |
23892 KB |
Output is correct |
8 |
Correct |
13 ms |
23892 KB |
Output is correct |
9 |
Correct |
12 ms |
23892 KB |
Output is correct |
10 |
Correct |
15 ms |
23892 KB |
Output is correct |
11 |
Correct |
12 ms |
23764 KB |
Output is correct |
12 |
Correct |
13 ms |
23744 KB |
Output is correct |
13 |
Correct |
12 ms |
23764 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
12 ms |
23820 KB |
Output is correct |
16 |
Correct |
22 ms |
31292 KB |
Output is correct |
17 |
Correct |
25 ms |
30808 KB |
Output is correct |
18 |
Correct |
22 ms |
31828 KB |
Output is correct |
19 |
Correct |
204 ms |
234512 KB |
Output is correct |
20 |
Correct |
242 ms |
240024 KB |
Output is correct |
21 |
Correct |
237 ms |
157856 KB |
Output is correct |
22 |
Correct |
87 ms |
24084 KB |
Output is correct |
23 |
Correct |
87 ms |
24128 KB |
Output is correct |
24 |
Correct |
86 ms |
24116 KB |
Output is correct |
25 |
Correct |
90 ms |
24268 KB |
Output is correct |
26 |
Correct |
93 ms |
24164 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1780 ms |
1048576 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
23764 KB |
Output is correct |
2 |
Execution timed out |
3033 ms |
30180 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3040 ms |
36192 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23812 KB |
Output is correct |
3 |
Correct |
12 ms |
23764 KB |
Output is correct |
4 |
Correct |
12 ms |
23764 KB |
Output is correct |
5 |
Correct |
12 ms |
23764 KB |
Output is correct |
6 |
Correct |
12 ms |
23884 KB |
Output is correct |
7 |
Correct |
13 ms |
23892 KB |
Output is correct |
8 |
Correct |
13 ms |
23892 KB |
Output is correct |
9 |
Correct |
12 ms |
23892 KB |
Output is correct |
10 |
Correct |
15 ms |
23892 KB |
Output is correct |
11 |
Correct |
12 ms |
23764 KB |
Output is correct |
12 |
Correct |
13 ms |
23744 KB |
Output is correct |
13 |
Correct |
12 ms |
23764 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
12 ms |
23820 KB |
Output is correct |
16 |
Correct |
22 ms |
31292 KB |
Output is correct |
17 |
Correct |
25 ms |
30808 KB |
Output is correct |
18 |
Correct |
22 ms |
31828 KB |
Output is correct |
19 |
Correct |
204 ms |
234512 KB |
Output is correct |
20 |
Correct |
242 ms |
240024 KB |
Output is correct |
21 |
Correct |
237 ms |
157856 KB |
Output is correct |
22 |
Correct |
87 ms |
24084 KB |
Output is correct |
23 |
Correct |
87 ms |
24128 KB |
Output is correct |
24 |
Correct |
86 ms |
24116 KB |
Output is correct |
25 |
Correct |
90 ms |
24268 KB |
Output is correct |
26 |
Correct |
93 ms |
24164 KB |
Output is correct |
27 |
Correct |
842 ms |
630112 KB |
Output is correct |
28 |
Correct |
748 ms |
771044 KB |
Output is correct |
29 |
Correct |
729 ms |
740532 KB |
Output is correct |
30 |
Correct |
314 ms |
24772 KB |
Output is correct |
31 |
Correct |
336 ms |
24780 KB |
Output is correct |
32 |
Correct |
309 ms |
24908 KB |
Output is correct |
33 |
Runtime error |
1281 ms |
1048576 KB |
Execution killed with signal 9 |
34 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
23764 KB |
Output is correct |
2 |
Correct |
12 ms |
23812 KB |
Output is correct |
3 |
Correct |
12 ms |
23764 KB |
Output is correct |
4 |
Correct |
12 ms |
23764 KB |
Output is correct |
5 |
Correct |
12 ms |
23764 KB |
Output is correct |
6 |
Correct |
12 ms |
23884 KB |
Output is correct |
7 |
Correct |
13 ms |
23892 KB |
Output is correct |
8 |
Correct |
13 ms |
23892 KB |
Output is correct |
9 |
Correct |
12 ms |
23892 KB |
Output is correct |
10 |
Correct |
15 ms |
23892 KB |
Output is correct |
11 |
Correct |
12 ms |
23764 KB |
Output is correct |
12 |
Correct |
13 ms |
23744 KB |
Output is correct |
13 |
Correct |
12 ms |
23764 KB |
Output is correct |
14 |
Correct |
12 ms |
23764 KB |
Output is correct |
15 |
Correct |
12 ms |
23820 KB |
Output is correct |
16 |
Correct |
22 ms |
31292 KB |
Output is correct |
17 |
Correct |
25 ms |
30808 KB |
Output is correct |
18 |
Correct |
22 ms |
31828 KB |
Output is correct |
19 |
Correct |
204 ms |
234512 KB |
Output is correct |
20 |
Correct |
242 ms |
240024 KB |
Output is correct |
21 |
Correct |
237 ms |
157856 KB |
Output is correct |
22 |
Correct |
87 ms |
24084 KB |
Output is correct |
23 |
Correct |
87 ms |
24128 KB |
Output is correct |
24 |
Correct |
86 ms |
24116 KB |
Output is correct |
25 |
Correct |
90 ms |
24268 KB |
Output is correct |
26 |
Correct |
93 ms |
24164 KB |
Output is correct |
27 |
Runtime error |
1780 ms |
1048576 KB |
Execution killed with signal 9 |
28 |
Halted |
0 ms |
0 KB |
- |