#include <bits/stdc++.h>
using namespace std;
#define int long long
#define INF 1000000000000000000
#define MOD 998244353
#define x second.first
#define y second.second
#define r first.first
bool cmp(pair<pair<int, int>, pair<int, int>> a, pair<pair<int, int>, pair<int, int>> b) {
if(a.first.first != b.first.first) return a.first.first > b.first.first;
else return a.first.second < b.first.second;
}
int32_t main() {
ios_base::sync_with_stdio(0);
cin.tie(0); cout.tie(0);
int n, x1, y1, r1;
cin >> n;
pair<pair<int, int>, pair<int, int>> a[n];
for(int i = 0; i < n; i++) {
cin >> x1 >> y1 >> r1;
a[i] = {{r1, i}, {x1, y1}};
}
sort(a, a+n, cmp);
int ans[n];
memset(ans, -1, sizeof(ans));
for(int i = 0; i < n; i++) if(ans[a[i].first.second] == -1) {
cout << a[i].x << " " << a[i].y << " " << a[i].r << " " << a[i].first.second << endl;
for(int j = 0; j < n; j++) if(ans[a[j].first.second] == -1) {
if((a[i].x-a[j].x)*(a[i].x-a[j].x) + (a[i].y-a[j].y)*(a[i].y-a[j].y) <= (a[i].r+a[j].r)*(a[i].r+a[j].r)) {
ans[a[j].first.second] = a[i].first.second;
}
}
}
for(int i = 0; i < n; i++) cout << ans[i]+1 << " ";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
131 ms |
20436 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
3086 ms |
20144 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |