#include <bits/stdc++.h>
#define endl '\n'
#define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0)
#define int ll
#define all(vec) vec.begin(), vec.end()
typedef long long ll;
using namespace std;
const int N = 3e5 + 10, mod = 1e9 + 7;
int n, x[N], y[N], r[N], ans[N];
vector<pair<int, int> > v;
signed main()
{
FAST;
cin >> n;
for(int i = 1; i <= n; i++) {
int x1, y1, r1;
cin >> x1 >> y1 >> r1;
v.push_back({r1, -i});
x[i] = x1;
y[i] = y1;
r[i] = r1;
}
sort(all(v));
reverse(all(v));
for(auto it : v) {
if(ans[-it.second] == 0) {
ans[-it.second] = -it.second;
for(auto i : v) {
if(i.second == it.second) continue;
int a = x[-it.second] - x[-i.second];
int b = y[-it.second] - y[-i.second];
int c = r[-it.second] + r[-i.second];
if((a)*(a)+(b)*(b) <= (c)*(c)) {
if(ans[-i.second] == 0) ans[-i.second] = -it.second;
}
}
}
}
for(int i = 1; i <= n; i++) cout << ans[i] << ' ';
cout << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
2 ms |
724 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
3 ms |
724 KB |
Output is correct |
22 |
Correct |
59 ms |
712 KB |
Output is correct |
23 |
Correct |
59 ms |
704 KB |
Output is correct |
24 |
Correct |
59 ms |
724 KB |
Output is correct |
25 |
Correct |
65 ms |
700 KB |
Output is correct |
26 |
Correct |
61 ms |
700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
133 ms |
16636 KB |
Output is correct |
2 |
Correct |
142 ms |
16568 KB |
Output is correct |
3 |
Correct |
160 ms |
16296 KB |
Output is correct |
4 |
Correct |
129 ms |
16652 KB |
Output is correct |
5 |
Execution timed out |
3046 ms |
14776 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
3081 ms |
5276 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3083 ms |
14788 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
2 ms |
724 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
3 ms |
724 KB |
Output is correct |
22 |
Correct |
59 ms |
712 KB |
Output is correct |
23 |
Correct |
59 ms |
704 KB |
Output is correct |
24 |
Correct |
59 ms |
724 KB |
Output is correct |
25 |
Correct |
65 ms |
700 KB |
Output is correct |
26 |
Correct |
61 ms |
700 KB |
Output is correct |
27 |
Correct |
5 ms |
984 KB |
Output is correct |
28 |
Correct |
7 ms |
984 KB |
Output is correct |
29 |
Correct |
5 ms |
988 KB |
Output is correct |
30 |
Correct |
239 ms |
944 KB |
Output is correct |
31 |
Correct |
230 ms |
948 KB |
Output is correct |
32 |
Correct |
244 ms |
940 KB |
Output is correct |
33 |
Correct |
47 ms |
5676 KB |
Output is correct |
34 |
Correct |
45 ms |
5696 KB |
Output is correct |
35 |
Correct |
105 ms |
5680 KB |
Output is correct |
36 |
Execution timed out |
3081 ms |
5124 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
1 ms |
340 KB |
Output is correct |
3 |
Correct |
0 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
0 ms |
340 KB |
Output is correct |
15 |
Correct |
1 ms |
340 KB |
Output is correct |
16 |
Correct |
1 ms |
340 KB |
Output is correct |
17 |
Correct |
1 ms |
340 KB |
Output is correct |
18 |
Correct |
1 ms |
340 KB |
Output is correct |
19 |
Correct |
2 ms |
724 KB |
Output is correct |
20 |
Correct |
3 ms |
724 KB |
Output is correct |
21 |
Correct |
3 ms |
724 KB |
Output is correct |
22 |
Correct |
59 ms |
712 KB |
Output is correct |
23 |
Correct |
59 ms |
704 KB |
Output is correct |
24 |
Correct |
59 ms |
724 KB |
Output is correct |
25 |
Correct |
65 ms |
700 KB |
Output is correct |
26 |
Correct |
61 ms |
700 KB |
Output is correct |
27 |
Correct |
133 ms |
16636 KB |
Output is correct |
28 |
Correct |
142 ms |
16568 KB |
Output is correct |
29 |
Correct |
160 ms |
16296 KB |
Output is correct |
30 |
Correct |
129 ms |
16652 KB |
Output is correct |
31 |
Execution timed out |
3046 ms |
14776 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |