#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll>pairll;
typedef pair<ll,pairll>pairlll;
typedef pair<pairll,pairll>pairllll;
typedef long double ld;
typedef pair<ll,string>pairls;
#define INF 1000000000000007
#define pb push_back
#define fr first
#define sc second
ll n;
struct D{
ll x,y,r,N;
}d[300007];
bool mcp(D d1, D d2){
if(d1.r!=d2.r)return d1.r>d2.r;
return d1.N<d2.N;
}
void RES(){
ll res[5007];
sort(d+1,d+1+n,mcp);
for(int i=1;i<=n;i++){
for(int j=1;j<=i;j++){
if((d[j].x-d[i].x)*(d[j].x-d[i].x)+(d[j].y-d[i].y)*(d[j].y-d[i].y)<=(d[j].r+d[i].r)*(d[j].r+d[i].r) && (res[d[j].N]==d[j].N || i==j)){
res[d[i].N]=d[j].N;
break;
}
}
}
for(int i=1;i<=n;i++){
cout<<res[i]<<" ";
}
cout<<endl;
return ;
}
int main()
{
cin>>n;
for(int i=1;i<=n;i++){
cin>>d[i].x>>d[i].y>>d[i].r;
d[i].N=i;
}
if(n<=5000){
RES();
return 0;
}
return 0;
}
/*
11
9 9 2
13 2 1
11 8 2
3 3 2
3 12 1
12 14 1
9 8 5
2 8 2
5 2 1
14 4 2
14 14 1
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
2 ms |
332 KB |
Output is correct |
17 |
Correct |
2 ms |
332 KB |
Output is correct |
18 |
Correct |
2 ms |
332 KB |
Output is correct |
19 |
Correct |
8 ms |
504 KB |
Output is correct |
20 |
Correct |
9 ms |
460 KB |
Output is correct |
21 |
Correct |
11 ms |
460 KB |
Output is correct |
22 |
Correct |
30 ms |
480 KB |
Output is correct |
23 |
Correct |
40 ms |
480 KB |
Output is correct |
24 |
Correct |
29 ms |
480 KB |
Output is correct |
25 |
Correct |
28 ms |
480 KB |
Output is correct |
26 |
Correct |
29 ms |
480 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
337 ms |
15976 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
332 KB |
Output is correct |
2 |
Incorrect |
131 ms |
5808 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
380 ms |
17188 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
2 ms |
332 KB |
Output is correct |
17 |
Correct |
2 ms |
332 KB |
Output is correct |
18 |
Correct |
2 ms |
332 KB |
Output is correct |
19 |
Correct |
8 ms |
504 KB |
Output is correct |
20 |
Correct |
9 ms |
460 KB |
Output is correct |
21 |
Correct |
11 ms |
460 KB |
Output is correct |
22 |
Correct |
30 ms |
480 KB |
Output is correct |
23 |
Correct |
40 ms |
480 KB |
Output is correct |
24 |
Correct |
29 ms |
480 KB |
Output is correct |
25 |
Correct |
28 ms |
480 KB |
Output is correct |
26 |
Correct |
29 ms |
480 KB |
Output is correct |
27 |
Incorrect |
14 ms |
516 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
332 KB |
Output is correct |
2 |
Correct |
0 ms |
332 KB |
Output is correct |
3 |
Correct |
1 ms |
332 KB |
Output is correct |
4 |
Correct |
1 ms |
332 KB |
Output is correct |
5 |
Correct |
0 ms |
332 KB |
Output is correct |
6 |
Correct |
1 ms |
332 KB |
Output is correct |
7 |
Correct |
1 ms |
332 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
1 ms |
332 KB |
Output is correct |
16 |
Correct |
2 ms |
332 KB |
Output is correct |
17 |
Correct |
2 ms |
332 KB |
Output is correct |
18 |
Correct |
2 ms |
332 KB |
Output is correct |
19 |
Correct |
8 ms |
504 KB |
Output is correct |
20 |
Correct |
9 ms |
460 KB |
Output is correct |
21 |
Correct |
11 ms |
460 KB |
Output is correct |
22 |
Correct |
30 ms |
480 KB |
Output is correct |
23 |
Correct |
40 ms |
480 KB |
Output is correct |
24 |
Correct |
29 ms |
480 KB |
Output is correct |
25 |
Correct |
28 ms |
480 KB |
Output is correct |
26 |
Correct |
29 ms |
480 KB |
Output is correct |
27 |
Incorrect |
337 ms |
15976 KB |
Output isn't correct |
28 |
Halted |
0 ms |
0 KB |
- |