This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC target("avx512f")
#pragma GCC optimize("O2")
#include <bits/stdc++.h>
using namespace std;
int main(){
int N;
cin>>N;
vector<long long> X(N),Y(N),R(N);
for(int i=0;i<N;i++) cin>>X[i]>>Y[i]>>R[i];
vector<int> A(N,N+1);
vector<pair<long long, long long>> S(N);
for(int i=0;i<N;i++) S[i] = {R[i],N-1-i};
sort(S.rbegin(),S.rend());
for(int i=0;i<N;i++){
int ind = N-1-S[i].second;
if(A[ind] != N+1) continue;
for(int j=0;j<N;j++){
if(A[j] == N+1 && (X[ind]-X[j])*(X[ind]-X[j])+(Y[ind]-Y[j])*(Y[ind]-Y[j]) <= (R[ind]+R[j])*(R[ind]+R[j])){
A[j] = ind+1;
}
}
if(clock()*1.0/CLOCKS_PER_SEC > 2.95){
break;
}
}
for(int i=0;i<N;i++) cout<<(A[i] == N+1 ? i+1 : A[i])<<' ';
cout<<endl;
}
# | 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... |