# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
49426 | gs13105 | Circle selection (APIO18_circle_selection) | C++17 | 157 ms | 5340 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 <cstdio>
#include <cstdlib>
#include <cstring>
#include <cassert>
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <list>
#include <stack>
#include <queue>
#include <deque>
#include <set>
#include <map>
#include <tuple>
#include <iterator>
using namespace std;
struct cir
{
int x, y, r, i;
bool operator <(const cir &a) const
{
return r != a.r ? r > a.r : i < a.i;
}
};
cir arr[300010];
int num[300010];
int res[300010];
bool inter(const cir &a, const cir &b)
{
return 1LL * (a.x - b.x) * (a.x - b.x) + 1LL * (a.y - b.y) * (a.y - b.y) <= 1LL * (a.r + b.r) * (a.r + b.r);
}
int main()
{
//freopen("in", "r", stdin);
//freopen("out", "w", stdout);
int n, i, j;
scanf("%d", &n);
for(i = 1; i <= n; i++)
{
int x, y, r;
scanf("%d%d%d", &x, &y, &r);
arr[i] = { x, y, r, i };
}
sort(arr + 1, arr + n + 1);
if(n <= 5000)
{
for(i = 1; i <= n; i++)
if(!num[i])
for(j = 1; j <= n; j++)
if(!num[j] && inter(arr[i], arr[j]))
num[j] = arr[i].i;
for(i = 1; i <= n; i++)
res[arr[i].i] = num[i];
for(i = 1; i <= n; i++)
printf("%d ", res[i]);
return 0;
}
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... |