#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;
class point2d {
public:
long long x, y;
point2d() : x(0), y(0) {};
point2d(long long x_, long long y_) : x(x_), y(y_) {};
point2d& operator+=(const point2d& p) { x += p.x; y += p.y; return *this; }
point2d& operator-=(const point2d& p) { x -= p.x; y -= p.y; return *this; }
point2d operator+(const point2d& p) const { return point2d(*this) += p; }
point2d operator-(const point2d& p) const { return point2d(*this) -= p; }
long long norm() const { return x * x + y * y; }
};
int main() {
int n;
cin >> n;
vector<point2d> p(n);
vector<long long> r(n);
for(int i = 0; i < n; ++i) {
cin >> p[i].x >> p[i].y >> r[i];
}
vector<int> ans(n, -1);
while(true) {
int ptr = -1; long long radius = -1;
for(int i = 0; i < n; ++i) {
if(ans[i] != -1) continue;
if(radius < r[i]) {
radius = r[i];
ptr = i;
}
}
if(ptr == -1) break;
for(int i = 0; i < n; ++i) {
if(ans[i] == -1 && (p[ptr] - p[i]).norm() <= 1LL * (r[ptr] + r[i]) * (r[ptr] + r[i])) {
ans[i] = ptr;
}
}
}
for(int i = 0; i < n; ++i) {
if(i) cout << ' ';
cout << ans[i] + 1;
}
cout << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
460 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
9 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
11 ms |
640 KB |
Output is correct |
22 |
Correct |
177 ms |
640 KB |
Output is correct |
23 |
Correct |
161 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
624 KB |
Output is correct |
25 |
Correct |
168 ms |
760 KB |
Output is correct |
26 |
Correct |
171 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
378 ms |
10616 KB |
Output is correct |
2 |
Correct |
413 ms |
15704 KB |
Output is correct |
3 |
Correct |
398 ms |
15484 KB |
Output is correct |
4 |
Correct |
375 ms |
15688 KB |
Output is correct |
5 |
Execution timed out |
3012 ms |
13176 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Execution timed out |
3021 ms |
3068 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3021 ms |
8476 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
460 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
9 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
11 ms |
640 KB |
Output is correct |
22 |
Correct |
177 ms |
640 KB |
Output is correct |
23 |
Correct |
161 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
624 KB |
Output is correct |
25 |
Correct |
168 ms |
760 KB |
Output is correct |
26 |
Correct |
171 ms |
760 KB |
Output is correct |
27 |
Correct |
21 ms |
1024 KB |
Output is correct |
28 |
Correct |
15 ms |
928 KB |
Output is correct |
29 |
Correct |
24 ms |
896 KB |
Output is correct |
30 |
Correct |
656 ms |
896 KB |
Output is correct |
31 |
Correct |
790 ms |
1016 KB |
Output is correct |
32 |
Correct |
697 ms |
988 KB |
Output is correct |
33 |
Correct |
164 ms |
5880 KB |
Output is correct |
34 |
Correct |
166 ms |
5752 KB |
Output is correct |
35 |
Correct |
194 ms |
5832 KB |
Output is correct |
36 |
Execution timed out |
3010 ms |
4984 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
3 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
3 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
8 |
Correct |
2 ms |
256 KB |
Output is correct |
9 |
Correct |
3 ms |
384 KB |
Output is correct |
10 |
Correct |
3 ms |
256 KB |
Output is correct |
11 |
Correct |
2 ms |
256 KB |
Output is correct |
12 |
Correct |
3 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
460 KB |
Output is correct |
14 |
Correct |
3 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
4 ms |
384 KB |
Output is correct |
17 |
Correct |
3 ms |
384 KB |
Output is correct |
18 |
Correct |
5 ms |
384 KB |
Output is correct |
19 |
Correct |
9 ms |
640 KB |
Output is correct |
20 |
Correct |
15 ms |
640 KB |
Output is correct |
21 |
Correct |
11 ms |
640 KB |
Output is correct |
22 |
Correct |
177 ms |
640 KB |
Output is correct |
23 |
Correct |
161 ms |
632 KB |
Output is correct |
24 |
Correct |
164 ms |
624 KB |
Output is correct |
25 |
Correct |
168 ms |
760 KB |
Output is correct |
26 |
Correct |
171 ms |
760 KB |
Output is correct |
27 |
Correct |
378 ms |
10616 KB |
Output is correct |
28 |
Correct |
413 ms |
15704 KB |
Output is correct |
29 |
Correct |
398 ms |
15484 KB |
Output is correct |
30 |
Correct |
375 ms |
15688 KB |
Output is correct |
31 |
Execution timed out |
3012 ms |
13176 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |