# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
123949 | 2019-07-02T10:00:46 Z | hani | Circle selection (APIO18_circle_selection) | C++14 | 1640 ms | 9444 KB |
#include <bits/stdc++.h> using namespace std; struct cir { int x,y,r,in; bool eliminated; }; bool comp(cir a,cir b) { if(a.r==b.r) return a.in<b.in; return a.r>b.r; } bool inter(cir a,cir b) { double d=sqrt((a.x-b.x)*(a.x-b.x)+(a.y-b.y)*(a.y-b.y)); if (a.r+b.r >=d) return true; return false; } int main() { int n; cin>>n; cir t[n]; for(int i=0;i<n;i++) { int x,y,r; scanf("%d%d%d",&x,&y,&r ); t[i].x=x; t[i].y=y; t[i].r=r; t[i].in=i+1; t[i].eliminated=0; } sort(t,t+n,comp); //for(int i=0;i<n;i++){printf("%d %d %d %d \n",t[i].x,t[i].y,t[i].r,t[i].in);} int eliminations[n+1]; for (int i=0;i<n;i++) { if(!t[i].eliminated) { eliminations[t[i].in]=t[i].in; for(int j=i+1;j<n;j++) { if(inter(t[i],t[j]) && !t[j].eliminated) { eliminations[t[j].in]=t[i].in; t[j].eliminated=true; } } t[i].eliminated=true; } } for(int i=1;i<=n;i++) cout<<eliminations[i]<<" "; cout<<endl; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 289 ms | 9444 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 256 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1640 ms | 8296 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 256 KB | Output is correct |
2 | Incorrect | 2 ms | 256 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |