Submission #932360

#TimeUsernameProblemLanguageResultExecution timeMemory
932360hmm789Circle selection (APIO18_circle_selection)C++14
0 / 100
3086 ms20436 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...