#include <bits/stdc++.h>
using namespace std;
int b[323567],c[223456],a[323456],tt,d[234564];
int x,m,n,t,k,l;
int i , j,r,s,y,z;
vector <int> p[12345];
priority_queue <pair<int,int>>q;
int main(){
cin>> n;
for (i = 1; i <=n; i ++){
cin >>a[i]>>b[i]>>c[i];
q.push({c[i],-i});
for (j = 1; j<i; j ++){
if((a[i]-a[j])*(a[i]-a[j])+(b[i]-b[j])*(b[i]-b[j])<=(c[i]+c[j])*(c[i]+c[j])){
p[i].push_back(j);
p[j].push_back(i);
}
}
}
for (i = 0; i <n; i ++){
y = -q.top().second;
q.pop();
if (d[y])
continue;
d[y]=y;
//cout << y<<' ';
for(auto u:p[y]){
if (d[u])
continue;
else d[u] = y;
}
}
for (i = 1; i<=n; i ++)
cout << d[i]<<' ';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
640 KB |
Output is correct |
2 |
Incorrect |
0 ms |
640 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1938 ms |
772268 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
640 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
1951 ms |
788856 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
640 KB |
Output is correct |
2 |
Incorrect |
0 ms |
640 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
640 KB |
Output is correct |
2 |
Incorrect |
0 ms |
640 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |