#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int nx=5e3+5;
ll n, x[nx], y[nx], r[nx], used[nx], res[nx];
int main()
{
cin.tie(NULL)->sync_with_stdio(false);
cin>>n;
for (int i=1; i<=n; i++) cin>>x[i]>>y[i]>>r[i];
for (int i=1; i<=n; i++)
{
pair<ll, ll> p={0, 0};
for (int j=1; j<=n; j++) if (!used[j]) p=max(p, {r[j], -j});
if (p.first==0) continue;
for (int j=1; j<=n; j++) if (!used[j]&&((x[-p.second]-x[j])*(x[-p.second]-x[j])+(y[-p.second]-y[j])*(y[-p.second]-y[j])<=(r[-p.second]+r[j])*(r[-p.second]+r[j]))) used[j]=1, res[j]=-p.second;
}
for (int i=1; i<=n; i++) cout<<res[i]<<' ';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
14 ms |
856 KB |
Output is correct |
20 |
Correct |
10 ms |
604 KB |
Output is correct |
21 |
Correct |
10 ms |
856 KB |
Output is correct |
22 |
Correct |
100 ms |
788 KB |
Output is correct |
23 |
Correct |
100 ms |
604 KB |
Output is correct |
24 |
Correct |
102 ms |
604 KB |
Output is correct |
25 |
Correct |
100 ms |
600 KB |
Output is correct |
26 |
Correct |
100 ms |
600 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Incorrect |
2 ms |
944 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
14 ms |
856 KB |
Output is correct |
20 |
Correct |
10 ms |
604 KB |
Output is correct |
21 |
Correct |
10 ms |
856 KB |
Output is correct |
22 |
Correct |
100 ms |
788 KB |
Output is correct |
23 |
Correct |
100 ms |
604 KB |
Output is correct |
24 |
Correct |
102 ms |
604 KB |
Output is correct |
25 |
Correct |
100 ms |
600 KB |
Output is correct |
26 |
Correct |
100 ms |
600 KB |
Output is correct |
27 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
600 KB |
Output is correct |
14 |
Correct |
1 ms |
348 KB |
Output is correct |
15 |
Correct |
0 ms |
348 KB |
Output is correct |
16 |
Correct |
1 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
348 KB |
Output is correct |
18 |
Correct |
1 ms |
348 KB |
Output is correct |
19 |
Correct |
14 ms |
856 KB |
Output is correct |
20 |
Correct |
10 ms |
604 KB |
Output is correct |
21 |
Correct |
10 ms |
856 KB |
Output is correct |
22 |
Correct |
100 ms |
788 KB |
Output is correct |
23 |
Correct |
100 ms |
604 KB |
Output is correct |
24 |
Correct |
102 ms |
604 KB |
Output is correct |
25 |
Correct |
100 ms |
600 KB |
Output is correct |
26 |
Correct |
100 ms |
600 KB |
Output is correct |
27 |
Runtime error |
2 ms |
1116 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |