Submission #981502

#TimeUsernameProblemLanguageResultExecution timeMemory
981502vjudge1Circle selection (APIO18_circle_selection)C++17
7 / 100
154 ms35876 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 1e6 + 5, MOD = 998244353; typedef long double ld; ld dist(ld x,ld y,ld x1,ld y1){ return sqrtl((x- x1) * (x - x1) + (y - y1) * (y - y1)); } int n,p[N],res[N]; vector<array<ld,4>> a; void test(){ cin >> n; for(int i = 1;i <= n;i++){ ll _x,_y,_r; cin >> _x >> _y >> _r; a.push_back({(ld)_r,(ld)-i,(ld)_x,(ld)_y}); res[i] = -1; } sort(a.rbegin(),a.rend()); if(n <= 5000) { for (int j = 0; j < n; j++) { ld r = a[j][0], x = a[j][2], y = a[j][3]; int i = -a[j][1]; if(res[i] != -1) continue; res[i] = i; for (int k = j + 1; k < n; k++) { if (res[(int)-a[k][1]]==-1&&dist(x,y,a[k][2],a[k][3]) <= r + a[k][0]) { res[(int)-a[k][1]] = i; } } } } for(int i = 1;i <= n;i++){ cout << res[i] << '\n'; } } int main(){ ios_base::sync_with_stdio(false);cin.tie(0); int T = 1; // cin >> T; while (T--){ test(); } }
#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...