#include <bits/stdc++.h>
#define F first
#define S second
#define sz(x) int(x.size())
#define pb push_back
#define N 300005
#define M ll(998244353)
using namespace std;
typedef long double ld;
typedef long long ll;
typedef short int si;
int main()
{
ios_base::sync_with_stdio(0); istream::sync_with_stdio(0); cin.tie(0); cout.tie(0);
int n;
cin >> n;
int ans[n];
for (int i = 0; i < n; i++) ans[i] = -1;
ld x[n], y[n], r[n];
for (int i = 0; i < n; i++) cin >> x[i] >> y[i] >> r[i];
int s = n;
while (s > 0)
{
int nm = -1;
for (int i = 0; i < n; i++)
{
if (ans[i] != -1) continue;
if (nm == -1 || r[nm] < r[i]) nm = i;
}
for (int i = 0; i < n; i++)
{
if (ans[i] != -1) continue;
ld rst = sqrt(pow(abs(x[nm] - x[i]), 2) + pow(abs(y[nm] - y[i]), 2));
if (r[nm] + r[i] >= rst) {ans[i] = nm + 1; s--;}
}
}
for (int i = 0; i < n; i++) cout << ans[i] << " ";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 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 |
6 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
10 ms |
768 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
11 ms |
768 KB |
Output is correct |
22 |
Correct |
305 ms |
768 KB |
Output is correct |
23 |
Correct |
319 ms |
776 KB |
Output is correct |
24 |
Correct |
316 ms |
888 KB |
Output is correct |
25 |
Correct |
304 ms |
768 KB |
Output is correct |
26 |
Correct |
315 ms |
888 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
317 ms |
18040 KB |
Output is correct |
2 |
Correct |
326 ms |
18176 KB |
Output is correct |
3 |
Correct |
309 ms |
17784 KB |
Output is correct |
4 |
Correct |
315 ms |
18296 KB |
Output is correct |
5 |
Execution timed out |
3053 ms |
15868 KB |
Time limit exceeded |
6 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
384 KB |
Output is correct |
2 |
Execution timed out |
3080 ms |
5624 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3078 ms |
15844 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 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 |
6 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
10 ms |
768 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
11 ms |
768 KB |
Output is correct |
22 |
Correct |
305 ms |
768 KB |
Output is correct |
23 |
Correct |
319 ms |
776 KB |
Output is correct |
24 |
Correct |
316 ms |
888 KB |
Output is correct |
25 |
Correct |
304 ms |
768 KB |
Output is correct |
26 |
Correct |
315 ms |
888 KB |
Output is correct |
27 |
Correct |
21 ms |
1152 KB |
Output is correct |
28 |
Correct |
16 ms |
1152 KB |
Output is correct |
29 |
Correct |
17 ms |
1152 KB |
Output is correct |
30 |
Correct |
1277 ms |
1156 KB |
Output is correct |
31 |
Correct |
1287 ms |
1272 KB |
Output is correct |
32 |
Correct |
1284 ms |
1272 KB |
Output is correct |
33 |
Correct |
124 ms |
6264 KB |
Output is correct |
34 |
Correct |
137 ms |
6288 KB |
Output is correct |
35 |
Correct |
134 ms |
6264 KB |
Output is correct |
36 |
Execution timed out |
3081 ms |
5668 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
4 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 |
6 ms |
384 KB |
Output is correct |
17 |
Correct |
6 ms |
384 KB |
Output is correct |
18 |
Correct |
6 ms |
384 KB |
Output is correct |
19 |
Correct |
10 ms |
768 KB |
Output is correct |
20 |
Correct |
10 ms |
768 KB |
Output is correct |
21 |
Correct |
11 ms |
768 KB |
Output is correct |
22 |
Correct |
305 ms |
768 KB |
Output is correct |
23 |
Correct |
319 ms |
776 KB |
Output is correct |
24 |
Correct |
316 ms |
888 KB |
Output is correct |
25 |
Correct |
304 ms |
768 KB |
Output is correct |
26 |
Correct |
315 ms |
888 KB |
Output is correct |
27 |
Correct |
317 ms |
18040 KB |
Output is correct |
28 |
Correct |
326 ms |
18176 KB |
Output is correct |
29 |
Correct |
309 ms |
17784 KB |
Output is correct |
30 |
Correct |
315 ms |
18296 KB |
Output is correct |
31 |
Execution timed out |
3053 ms |
15868 KB |
Time limit exceeded |
32 |
Halted |
0 ms |
0 KB |
- |