# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
134910 | Lawliet | Circle selection (APIO18_circle_selection) | C++14 | 340 ms | 27596 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>
#define MAX 5010
#define R first.first
#define X second.first
#define Y second.second
using namespace std;
typedef long long int lli;
typedef pair<lli,lli> pii;
typedef pair<pii,pii> circle;
int n;
int n1, n2, n3, n4;
int removed[MAX];
vector<circle> v;
lli equation(int i, lli x, lli y)
{
return (v[i].X - x)*(v[i].X - x) + (v[i].Y - y)*(v[i].Y - y);
}
lli dist(int i, int j)
{
return (v[i].X - v[j].X)*(v[i].X - v[j].X) + (v[i].Y - v[j].Y)*(v[i].Y - v[j].Y);
}
bool intersect(int i, int j)
{
return (dist(i , j) <= (v[i].R + v[j].R)*(v[i].R + v[j].R));
}
int main()
{
scanf("%d",&n);
memset(removed , -1 , sizeof(removed));
for(int g = 1 ; g <= n ; g++)
{
scanf("%d %d %d",&n1,&n2,&n3);
circle k;
k = {{-n3 , g} , {n1 , n2}};
v.push_back( k );
}
sort(v.begin() , v.end());
for(int g = 0 ; g < n ; g++)
{
int curInd = v[g].first.second;
if(removed[curInd] != -1) continue;
for(int h = g ; h < n ; h++)
{
if(intersect(g , h))
{
int ind = v[h].first.second;
removed[ind] = curInd;
}
}
}
for(int g = 1 ; g <= n ; g++)
printf("%d ",removed[g]);
}
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... |