Submission #698752

#TimeUsernameProblemLanguageResultExecution timeMemory
698752vjudge1Circle selection (APIO18_circle_selection)C++17
0 / 100
3072 ms16560 KiB
#include <bits/stdc++.h> #define endl '\n' #define FAST ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0) #define int ll #define all(vec) vec.begin(), vec.end() typedef long long ll; using namespace std; const int N = 3e5 + 10, mod = 1e9 + 7; int n, x[N], y[N], r[N], ans[N]; vector<pair<int, int> > v; signed main() { FAST; cin >> n; for(int i = 1; i <= n; i++) { int x1, y1, r1; cin >> x1 >> y1 >> r1; v.push_back({r1, -i}); x[i] = x1; y[i] = y1; r[i] = r1; } sort(all(v)); reverse(all(v)); for(auto it : v) { if(ans[-it.second] == 0) { ans[-it.second] = -it.second; for(auto i : v) { int a = x[-it.second] - x[-i.second]; int b = y[-it.second] - y[-i.second]; int c = r[-it.second] + r[-i.second]; if((a*a) + (b*b) <= (c * c)) { if(ans[-i.second] == 0) ans[-i.second] = -it.second; if(-i.second == 4) cout << it.second << endl; } } } } for(int i = 1; i <= n; i++) cout << ans[i] << ' '; cout << endl; }
#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...