Submission #982980

#TimeUsernameProblemLanguageResultExecution timeMemory
982980vjudge1Circle selection (APIO18_circle_selection)C++17
7 / 100
3099 ms16812 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int n, i, j, k, x[300001], y[300001], r[300001], ans[300001]; bool u[300001]; long double dist(long double x1, long double y1, long double x2, long double y2) { return sqrt((x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1)); } bool inter(int i, int j) { return r[i] + r[j] >= dist(x[i], y[i], x[j], y[j]); } signed main() { cin.tie(0)->sync_with_stdio(0); #ifdef LOCAL freopen("input.txt", "r", stdin); #endif cin >> n; for (i = 1; i <= n; i++) { cin >> x[i] >> y[i] >> r[i]; } for (i = 1; i <= n; i++) { k = 0; for (j = 1; j <= n; j++) { if (r[j] > r[k] && !u[j]) k = j; } u[k] = 1; ans[k] = k; for (j = 1; j <= n; j++) { if (u[j]) continue; if (inter(k, j)) { u[j] = 1; ans[j] = k; } } } for (i = 1; i <= n; i++) cout << ans[i] << " "; }
#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...