# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1087886 | alexander707070 | Circle selection (APIO18_circle_selection) | C++14 | 3080 ms | 1048576 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 MAXN 1000007
using namespace std;
int n,par[MAXN];
long long x[MAXN],y[MAXN],r[MAXN];
pair<int,int> p[MAXN];
vector<int> g[MAXN];
int main(){
cin>>n;
for(int i=1;i<=n;i++){
cin>>x[i]>>y[i]>>r[i];
p[i]={r[i],-i};
}
sort(p+1,p+n+1);
for(int i=1;i<=n;i++){
for(int f=i+1;f<=n;f++){
if((x[i]-x[f])*(x[i]-x[f]) + (y[i]-y[f])*(y[i]-y[f]) <= (r[i]+r[f])*(r[i]+r[f])){
g[i].push_back(f);
g[f].push_back(i);
}
}
}
for(int i=n;i>=1;i--){
int curr=-p[i].second;
if(par[curr]!=0)continue;
par[curr]=curr;
for(int f=0;f<g[curr].size();f++){
if(par[g[curr][f]]==0)par[g[curr][f]]=curr;
}
}
for(int i=1;i<=n;i++){
cout<<par[i]<<" ";
}
cout<<"\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... |