#include <bits/stdc++.h>
using namespace std;
struct circle
{
long long x,y,r,i;
circle(){}
circle(long long _x,long long _y,long long _r,long long _i)
{
x=_x;
y=_y;
r=_r;
i=_i;
}
};
long long n;
circle a[200001];
bool cmp(circle c1,circle c2)
{
if(c1.r==c2.r)return c1.i<c2.i;
return c1.r>c2.r;
}
void read()
{
cin>>n;
for(long long i=1;i<=n;i++)
{
cin>>a[i].x>>a[i].y>>a[i].r;
a[i].i=i;
}
sort(a+1,a+n+1,cmp);
}
long long used[200001];
bool intersect(circle c1,circle c2)
{
long long d1=(c1.x-c2.x)*(c1.x-c2.x)+(c1.y-c2.y)*(c1.y-c2.y);
long long d2=(c1.r+c2.r)*(c1.r+c2.r);
return d1<=d2;
}
void solve()
{
for(long long i=1;i<=n;i++)
{
if(used[a[i].i])continue;
for(long long j=i;j<=n;j++)
{
if(used[a[j].i])continue;
if(intersect(a[i],a[j]))
used[a[j].i]=a[i].i;
}
}
for(long long i=1;i<=n;i++)
cout<<used[i]<<" ";
cout<<endl;
}
int main()
{
read();
solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
2384 KB |
Output is correct |
5 |
Correct |
1 ms |
2552 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
1 ms |
2552 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
2384 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Correct |
1 ms |
2384 KB |
Output is correct |
16 |
Correct |
2 ms |
2384 KB |
Output is correct |
17 |
Correct |
2 ms |
2384 KB |
Output is correct |
18 |
Correct |
2 ms |
2524 KB |
Output is correct |
19 |
Correct |
6 ms |
2640 KB |
Output is correct |
20 |
Correct |
5 ms |
2648 KB |
Output is correct |
21 |
Correct |
6 ms |
2604 KB |
Output is correct |
22 |
Correct |
27 ms |
2640 KB |
Output is correct |
23 |
Correct |
26 ms |
2668 KB |
Output is correct |
24 |
Correct |
26 ms |
2640 KB |
Output is correct |
25 |
Correct |
26 ms |
2640 KB |
Output is correct |
26 |
Correct |
26 ms |
2504 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Execution timed out |
3068 ms |
12616 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2384 KB |
Output is correct |
2 |
Execution timed out |
3044 ms |
9516 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
156 ms |
21320 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
2384 KB |
Output is correct |
5 |
Correct |
1 ms |
2552 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
1 ms |
2552 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
2384 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Correct |
1 ms |
2384 KB |
Output is correct |
16 |
Correct |
2 ms |
2384 KB |
Output is correct |
17 |
Correct |
2 ms |
2384 KB |
Output is correct |
18 |
Correct |
2 ms |
2524 KB |
Output is correct |
19 |
Correct |
6 ms |
2640 KB |
Output is correct |
20 |
Correct |
5 ms |
2648 KB |
Output is correct |
21 |
Correct |
6 ms |
2604 KB |
Output is correct |
22 |
Correct |
27 ms |
2640 KB |
Output is correct |
23 |
Correct |
26 ms |
2668 KB |
Output is correct |
24 |
Correct |
26 ms |
2640 KB |
Output is correct |
25 |
Correct |
26 ms |
2640 KB |
Output is correct |
26 |
Correct |
26 ms |
2504 KB |
Output is correct |
27 |
Correct |
18 ms |
2896 KB |
Output is correct |
28 |
Correct |
10 ms |
2912 KB |
Output is correct |
29 |
Correct |
11 ms |
2920 KB |
Output is correct |
30 |
Correct |
92 ms |
2840 KB |
Output is correct |
31 |
Correct |
92 ms |
2652 KB |
Output is correct |
32 |
Correct |
96 ms |
2652 KB |
Output is correct |
33 |
Correct |
99 ms |
10332 KB |
Output is correct |
34 |
Correct |
100 ms |
10296 KB |
Output is correct |
35 |
Correct |
93 ms |
10068 KB |
Output is correct |
36 |
Execution timed out |
3037 ms |
9304 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2384 KB |
Output is correct |
2 |
Correct |
1 ms |
2384 KB |
Output is correct |
3 |
Correct |
1 ms |
2384 KB |
Output is correct |
4 |
Correct |
1 ms |
2384 KB |
Output is correct |
5 |
Correct |
1 ms |
2552 KB |
Output is correct |
6 |
Correct |
1 ms |
2384 KB |
Output is correct |
7 |
Correct |
1 ms |
2384 KB |
Output is correct |
8 |
Correct |
1 ms |
2384 KB |
Output is correct |
9 |
Correct |
1 ms |
2384 KB |
Output is correct |
10 |
Correct |
1 ms |
2384 KB |
Output is correct |
11 |
Correct |
1 ms |
2552 KB |
Output is correct |
12 |
Correct |
1 ms |
2384 KB |
Output is correct |
13 |
Correct |
1 ms |
2384 KB |
Output is correct |
14 |
Correct |
1 ms |
2384 KB |
Output is correct |
15 |
Correct |
1 ms |
2384 KB |
Output is correct |
16 |
Correct |
2 ms |
2384 KB |
Output is correct |
17 |
Correct |
2 ms |
2384 KB |
Output is correct |
18 |
Correct |
2 ms |
2524 KB |
Output is correct |
19 |
Correct |
6 ms |
2640 KB |
Output is correct |
20 |
Correct |
5 ms |
2648 KB |
Output is correct |
21 |
Correct |
6 ms |
2604 KB |
Output is correct |
22 |
Correct |
27 ms |
2640 KB |
Output is correct |
23 |
Correct |
26 ms |
2668 KB |
Output is correct |
24 |
Correct |
26 ms |
2640 KB |
Output is correct |
25 |
Correct |
26 ms |
2640 KB |
Output is correct |
26 |
Correct |
26 ms |
2504 KB |
Output is correct |
27 |
Execution timed out |
3068 ms |
12616 KB |
Time limit exceeded |
28 |
Halted |
0 ms |
0 KB |
- |