# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49316 | WLZ | Circle selection (APIO18_circle_selection) | C++17 | 3026 ms | 14552 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, pair<int, pair<int, int>>> circle;
int n;
bool* used;
vector<circle> v;
vector<int> ans;
int main() {
scanf("%d", &n);
used = new bool[n];
memset(used, 0, sizeof (bool) * n);
priority_queue<circle> pq;
ans.resize(n);
for (int i = 0; i < n; i++) {
int x, y, r;
scanf("%d %d %d", &x, &y, &r);
pq.push({r, {-i, {x, y}}});
v.push_back({r, {-i, {x, y}}});
}
while (!pq.empty()) {
circle cur = pq.top(); pq.pop();
int x = cur.second.second.first;
int y = cur.second.second.second;
if (used[-cur.second.first]) continue;
used[-cur.second.first] = true;
ans[-cur.second.first] = -cur.second.first;
for (int i = 0; i < n; i++) {
if (hypot(v[i].second.second.first - x, v[i].second.second.second - y) <= double(cur.first + v[i].first)) {
used[i] = true;
ans[i] = -cur.second.first;
}
}
}
for (int i = 0; i < n; i++) {
if (i) printf(" ");
printf("%d", ans[i] + 1);
}
printf("\n");
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |