Submission #287351

#TimeUsernameProblemLanguageResultExecution timeMemory
287351ScarletSCircle selection (APIO18_circle_selection)C++17
7 / 100
45 ms1152 KiB
#include <bits/stdc++.h> #define ll long long #define sz(x) (int)(x).size(); #define pii pair<ll,ll> #define f first #define s second using namespace std; ll sq(ll a) { return a*a; } int ans[5001]; pair<pii,pii> p[5000]; int main() { int n; cin>>n; for (int i=0;i<n;++i) { cin>>p[i].s.f>>p[i].s.s>>p[i].f.f; p[i].f.s=-(i+1); } sort(p,p+n,greater<pair<pii,pii>>()); for (int i=0;i<n;++i) { if (ans[-(p[i].f.s)]) continue; for (int j=i;j<n;++j) if (!ans[-(p[j].f.s)]) if (sq(p[i].s.f-p[j].s.f)+sq(p[i].s.s-p[j].s.s)<=sq(p[i].f.f+p[j].f.f)) ans[-(p[j].f.s)]=-(p[i].f.s); } for (int i=1;i<=n;++i) cout<<ans[i]<<" "; }
#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...