#include<iostream>
#include<algorithm>
using namespace std;
typedef long long ll;
const int N = 3e5 + 7;
int n;
int ans[N];
struct Data {
int x, y, r, id;
Data() {}
bool operator < (const Data &o) const {
if (r != o.r) return r > o.r;
return id < o.id;
}
} a[N];
namespace subtask1 {
#define sqr(x) (ll)(x) * (x)
bool check(const Data &a, const Data &b) {
return sqr(a.r + b.r) >= sqr(a.x - b.x) + sqr(a.y - b.y);
}
#undef sqr
void solve() {
for (int i = 1; i <= n; ++i) if (!ans[a[i].id]) {
ans[a[i].id] = a[i].id;
for (int j = i + 1; j <= n; ++j)
if (!ans[a[j].id] && check(a[i], a[j])) ans[a[j].id] = a[i].id;
}
}
}
int main() {
cin.tie(NULL)->sync_with_stdio(false);
cin >> n;
for (int i = 1; i <= n; ++i)
cin >> a[i].x >> a[i].y >> a[i].r, a[i].id = i;
sort(a + 1, a + n + 1);
subtask1::solve();
for (int i = 1; i <= n; ++i) cout << ans[i] << ' ';
}
/** /\_/\
* (= ._.)
* / >0 \>1
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
320 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
596 KB |
Output is correct |
20 |
Correct |
3 ms |
596 KB |
Output is correct |
21 |
Correct |
3 ms |
596 KB |
Output is correct |
22 |
Correct |
28 ms |
656 KB |
Output is correct |
23 |
Correct |
29 ms |
552 KB |
Output is correct |
24 |
Correct |
29 ms |
548 KB |
Output is correct |
25 |
Correct |
28 ms |
468 KB |
Output is correct |
26 |
Correct |
25 ms |
552 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
126 ms |
14928 KB |
Output is correct |
2 |
Correct |
150 ms |
14932 KB |
Output is correct |
3 |
Correct |
132 ms |
14680 KB |
Output is correct |
4 |
Correct |
125 ms |
14960 KB |
Output is correct |
5 |
Execution timed out |
3046 ms |
10748 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Execution timed out |
3050 ms |
4968 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3046 ms |
13048 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
320 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
596 KB |
Output is correct |
20 |
Correct |
3 ms |
596 KB |
Output is correct |
21 |
Correct |
3 ms |
596 KB |
Output is correct |
22 |
Correct |
28 ms |
656 KB |
Output is correct |
23 |
Correct |
29 ms |
552 KB |
Output is correct |
24 |
Correct |
29 ms |
548 KB |
Output is correct |
25 |
Correct |
28 ms |
468 KB |
Output is correct |
26 |
Correct |
25 ms |
552 KB |
Output is correct |
27 |
Correct |
5 ms |
852 KB |
Output is correct |
28 |
Correct |
6 ms |
852 KB |
Output is correct |
29 |
Correct |
5 ms |
852 KB |
Output is correct |
30 |
Correct |
110 ms |
788 KB |
Output is correct |
31 |
Correct |
106 ms |
772 KB |
Output is correct |
32 |
Correct |
101 ms |
844 KB |
Output is correct |
33 |
Correct |
48 ms |
5916 KB |
Output is correct |
34 |
Correct |
51 ms |
5864 KB |
Output is correct |
35 |
Correct |
51 ms |
5708 KB |
Output is correct |
36 |
Execution timed out |
3057 ms |
4792 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
324 KB |
Output is correct |
5 |
Correct |
1 ms |
324 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
320 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
328 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
336 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
3 ms |
596 KB |
Output is correct |
20 |
Correct |
3 ms |
596 KB |
Output is correct |
21 |
Correct |
3 ms |
596 KB |
Output is correct |
22 |
Correct |
28 ms |
656 KB |
Output is correct |
23 |
Correct |
29 ms |
552 KB |
Output is correct |
24 |
Correct |
29 ms |
548 KB |
Output is correct |
25 |
Correct |
28 ms |
468 KB |
Output is correct |
26 |
Correct |
25 ms |
552 KB |
Output is correct |
27 |
Correct |
126 ms |
14928 KB |
Output is correct |
28 |
Correct |
150 ms |
14932 KB |
Output is correct |
29 |
Correct |
132 ms |
14680 KB |
Output is correct |
30 |
Correct |
125 ms |
14960 KB |
Output is correct |
31 |
Execution timed out |
3046 ms |
10748 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |