Submission #153233

#TimeUsernameProblemLanguageResultExecution timeMemory
153233usernameCircle selection (APIO18_circle_selection)C++14
49 / 100
3049 ms451904 KiB
#include<bits/stdc++.h> using namespace std; typedef pair<int,int> pii; #define REP(i,j,k) for(int i=(j);i<(k);++i) #define pb push_back #define F first #define S second #define IOS cin.tie(0),ios_base::sync_with_stdio(false) #define f2(x) (int64_t(x)*(x)) const int maxn=3e5+3,inf=2e9+3,bl=2e9+3; struct C{int x,y,r,id;}a[maxn]; int n,res[maxn]; bool rmv[maxn]; map<int64_t,vector<int>>mp; main(){ IOS; cin>>n; REP(i,0,n)cin>>a[i].x>>a[i].y>>a[i].r,a[i].id=i; sort(a,a+n,[](const C&x,const C&y){return x.r==y.r?x.id<y.id:x.r>y.r;}); int k=inf; REP(i,0,n){ if(rmv[i])continue; if(2*a[i].r<k){ k=a[i].r; mp.clear(); REP(j,i,n)if(!rmv[j])mp[(int64_t)a[j].x/k*bl+a[j].y/k].pb(j); } int xx=a[i].x/k,yy=a[i].y/k; REP(x,xx-5,xx)REP(y,yy-5,yy){ auto&tls=mp[(int64_t)(x+3)*bl+(y+3)]; for(auto it=tls.begin();it!=tls.end();++it){ if(!rmv[*it]&&f2(a[i].x-a[*it].x)+f2(a[i].y-a[*it].y)<=f2(a[i].r+a[*it].r)){ res[a[*it].id]=a[i].id; rmv[*it]=1; } } } } REP(i,0,n)cout<<res[i]+1<<" "; }

Compilation message (stderr)

circle_selection.cpp:17:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main(){
      ^
#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...