/*input
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
*/
#include<bits/stdc++.h>
using namespace std;
#define REP(i,n) for(int i=0;i<n;i++)
const int maxn=1e5+5;
#define pb push_back
#define lowb(x) x&(-x)
#define ll long long
#define MNTO(x,y) x=min(x,y)
#define REP1(i,n) for(int i=1;i<=n;i++)
#define pii pair<ll,ll>
#define f first
#define s second
pair<pii,ll> arr[maxn];
bool inter(int a,int b){
ll d=(arr[a].f.s-arr[b].f.s)*(arr[a].f.s-arr[b].f.s)+(arr[a].f.f-arr[b].f.f)*(arr[a].f.f-arr[b].f.f);
return d<=(arr[a].s+arr[b].s)*(arr[a].s+arr[b].s);
}
bool ok[maxn];
int ans[maxn];
int main(){
ios::sync_with_stdio(false),cin.tie(0);
int n;
cin>>n;
vector<int> v;
REP(i,n) cin>>arr[i].f.f>>arr[i].f.s>>arr[i].s,v.pb(i);
REP(i,n){
int p=-1;
for(int j:v){
if(ok[j]) continue;
if(p==-1 or arr[p].s<arr[j].s) p=j;
}
if(p==-1) break;
vector<int> nv;
for(int j:v){
if(inter(j,p)) ans[j]=p,ok[j]=1;
else nv.pb(j);
}
v=nv;
}
REP(i,n){
cout<<ans[i]+1<<' ';
}
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
20 |
Correct |
2 ms |
468 KB |
Output is correct |
21 |
Correct |
2 ms |
468 KB |
Output is correct |
22 |
Correct |
96 ms |
536 KB |
Output is correct |
23 |
Correct |
98 ms |
540 KB |
Output is correct |
24 |
Correct |
98 ms |
556 KB |
Output is correct |
25 |
Correct |
98 ms |
556 KB |
Output is correct |
26 |
Correct |
100 ms |
592 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
28 ms |
6280 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Execution timed out |
3082 ms |
4660 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
30 ms |
6244 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
20 |
Correct |
2 ms |
468 KB |
Output is correct |
21 |
Correct |
2 ms |
468 KB |
Output is correct |
22 |
Correct |
96 ms |
536 KB |
Output is correct |
23 |
Correct |
98 ms |
540 KB |
Output is correct |
24 |
Correct |
98 ms |
556 KB |
Output is correct |
25 |
Correct |
98 ms |
556 KB |
Output is correct |
26 |
Correct |
100 ms |
592 KB |
Output is correct |
27 |
Correct |
4 ms |
724 KB |
Output is correct |
28 |
Correct |
4 ms |
724 KB |
Output is correct |
29 |
Correct |
4 ms |
764 KB |
Output is correct |
30 |
Correct |
383 ms |
772 KB |
Output is correct |
31 |
Correct |
380 ms |
756 KB |
Output is correct |
32 |
Correct |
402 ms |
756 KB |
Output is correct |
33 |
Correct |
38 ms |
4172 KB |
Output is correct |
34 |
Correct |
36 ms |
4252 KB |
Output is correct |
35 |
Correct |
40 ms |
4172 KB |
Output is correct |
36 |
Execution timed out |
3076 ms |
4840 KB |
Time limit exceeded |
37 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
340 KB |
Output is correct |
13 |
Correct |
1 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 |
3 ms |
468 KB |
Output is correct |
20 |
Correct |
2 ms |
468 KB |
Output is correct |
21 |
Correct |
2 ms |
468 KB |
Output is correct |
22 |
Correct |
96 ms |
536 KB |
Output is correct |
23 |
Correct |
98 ms |
540 KB |
Output is correct |
24 |
Correct |
98 ms |
556 KB |
Output is correct |
25 |
Correct |
98 ms |
556 KB |
Output is correct |
26 |
Correct |
100 ms |
592 KB |
Output is correct |
27 |
Runtime error |
28 ms |
6280 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |