#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int N = 5010;
const int oo = 2e9;
int x[N], y[N], r[N], n, mrk[N];
ll sqr(ll x){ return (x * x);}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
// freopen("in.txt","r",stdin);
cin >> n;
for (int i = 0; i < n; i++)
cin >> x[i] >> y[i] >> r[i];
fill(mrk, mrk + n, -1);
int kol = n;
for (; kol > 0; ){
int nom = -1, mx = -1;
for (int i = 0; i < n; i++){
if (mrk[i] >= 0) continue;
if (r[i] > mx){
mx = r[i];
nom = i;
}
}
for (int i = 0; i < n; i++){
if (mrk[i] >= 0) continue;
ll cur = sqr(x[i] - x[nom]) + sqr(y[i] - y[nom]) - sqr(r[i] + r[nom]);
if (cur <= 0){
mrk[i] = nom;
kol--;
}
}
}
for (int i = 0; i < n; i++)
cout << mrk[i] + 1 << " ";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
7 ms |
640 KB |
Output is correct |
20 |
Correct |
7 ms |
640 KB |
Output is correct |
21 |
Correct |
7 ms |
640 KB |
Output is correct |
22 |
Correct |
164 ms |
632 KB |
Output is correct |
23 |
Correct |
164 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
636 KB |
Output is correct |
25 |
Correct |
201 ms |
592 KB |
Output is correct |
26 |
Correct |
184 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
10 ms |
1024 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 |
5 ms |
384 KB |
Output is correct |
2 |
Runtime error |
9 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
8 ms |
1024 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 |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
7 ms |
640 KB |
Output is correct |
20 |
Correct |
7 ms |
640 KB |
Output is correct |
21 |
Correct |
7 ms |
640 KB |
Output is correct |
22 |
Correct |
164 ms |
632 KB |
Output is correct |
23 |
Correct |
164 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
636 KB |
Output is correct |
25 |
Correct |
201 ms |
592 KB |
Output is correct |
26 |
Correct |
184 ms |
600 KB |
Output is correct |
27 |
Runtime error |
8 ms |
896 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
256 KB |
Output is correct |
2 |
Correct |
6 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
4 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
5 ms |
384 KB |
Output is correct |
7 |
Correct |
5 ms |
384 KB |
Output is correct |
8 |
Correct |
5 ms |
384 KB |
Output is correct |
9 |
Correct |
5 ms |
384 KB |
Output is correct |
10 |
Correct |
5 ms |
384 KB |
Output is correct |
11 |
Correct |
5 ms |
384 KB |
Output is correct |
12 |
Correct |
5 ms |
384 KB |
Output is correct |
13 |
Correct |
5 ms |
384 KB |
Output is correct |
14 |
Correct |
5 ms |
384 KB |
Output is correct |
15 |
Correct |
5 ms |
384 KB |
Output is correct |
16 |
Correct |
5 ms |
384 KB |
Output is correct |
17 |
Correct |
5 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
7 ms |
640 KB |
Output is correct |
20 |
Correct |
7 ms |
640 KB |
Output is correct |
21 |
Correct |
7 ms |
640 KB |
Output is correct |
22 |
Correct |
164 ms |
632 KB |
Output is correct |
23 |
Correct |
164 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
636 KB |
Output is correct |
25 |
Correct |
201 ms |
592 KB |
Output is correct |
26 |
Correct |
184 ms |
600 KB |
Output is correct |
27 |
Runtime error |
10 ms |
1024 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
28 |
Halted |
0 ms |
0 KB |
- |