#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const int maxn = 1e5 + 20;
const int inf = 1e9;
int c[maxn], r[maxn], p[maxn], pos[maxn], q[maxn];
vector<int> g[maxn];
ll dis(int x, int y, int X, int Y){
return 1ll*(x-X)*(x-X) + 1ll*(y-Y)*(y-Y);
}
int x[maxn], y[maxn];
int main(){
ios_base::sync_with_stdio(false);
int n;
cin >> n;
for (int i = 1; i <= n; i++)
cin >> x[i] >> y[i] >> r[i];
vector<pair<int,int>> a;
for (int i = 1; i <= n; i++)
p[i] = i, q[i] = i;
sort(q+1, q+n+1, [](int a, int b){
return x[a] < x[b];
});
for (int i = 1; i <= n; i++)
pos[x[i]] = i;
sort(p+1, p+n+1, [](int a, int b){
if (r[a] != r[b])
return r[a] > r[b];
return a < b;
});
for (int za = 1; za <= n; za++){
int i = p[za];
if (c[pos[i]] != 0)
continue;
for (int j = pos[i]+1; j <= n; j++){
if (c[j] != 0 or dis(x[i], y[i], x[q[j]], y[q[j]]) > 1ll*(r[i]+r[q[j]])*(r[i]+r[q[j]]))
break;
c[j] = i;
}
for (int j = pos[i]-1; j >= 1; j--){
if (c[j] != 0 or dis(x[i], y[i], x[q[j]], y[q[j]]) > 1ll*(r[i]+r[q[j]])*(r[i]+r[q[j]]))
break;
c[j] = i;
}
}
for (int i = 1; i <= n; i++)
cout << c[i] << " \n"[i == n];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
5248 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
80 ms |
8508 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
5248 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
92 ms |
8440 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
5248 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
5 ms |
5248 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |