Submission #864560

#TimeUsernameProblemLanguageResultExecution timeMemory
864560vnm06Circle selection (APIO18_circle_selection)C++14
7 / 100
80 ms21068 KiB
#include<bits/stdc++.h> #define endl '\n' using namespace std; int n; pair<long long, int> pr[300005]; long long x[300005], y[300005], r[300005]; int prem[300005]; void print_ans() { cout<<prem[1]; for(int j=2; j<=n; j++) cout<<" "<<prem[j]; cout<<endl; } void solve1() { for(int i1=1; i1<=n; i1++) { int i=pr[i1].second; if(prem[i]) continue; prem[i]=i; for(int j1=i1+1; j1<=n; j1++) { int j=pr[j1].second; if(prem[j]) continue; if((r[i]+r[j])*(r[i]+r[j])<(x[i]-x[j])*(x[i]-x[j])+(y[i]-y[j])*(y[i]-y[j])) continue; prem[j]=i; } } print_ans(); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin>>n; for(int i=1; i<=n; i++) {cin>>x[i]>>y[i]>>r[i]; pr[i]={-r[i], i};} sort(pr+1, pr+n+1); if(n<=5000) solve1(); return 0; } /** 11 9 9 2 13 2 1 11 8 2 3 3 2 3 12 1 12 14 1 9 8 5 2 8 2 5 2 1 14 4 2 14 14 1 */
#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...