Submission #3778

#TimeUsernameProblemLanguageResultExecution timeMemory
3778pl0892029Lonely mdic (kriii1_L)C++98
0 / 1
4 ms1108 KiB
#include <cstdio> #include <algorithm> #include <cmath> #define PI 3.1415926 using namespace std; typedef struct circle { int x,y,r; }circle; bool cmp(circle A,circle B) { return A.r > B.r; } double dist(int x,int y,double dx,double dy) { return sqrt((dx-x)*(dx-x)+(dy-y)*(dy-y)); } circle arr[500]; bool isNeeded[500]; int main() { int n; scanf("%d",&n); for(int i=0;i<n;i++) scanf("%d %d %d",&arr[i].x,&arr[i].y,&arr[i].r); sort(arr,arr+n,cmp); for(int i=0;i<n;i++) { bool check = true; for(int j=0;j<360;j++) { double x = arr[i].x+arr[i].r*sin(PI*j/180); double y = arr[i].y+arr[i].r*cos(PI*j/180); bool isIncluded = false; for(int k=0;k<i;k++) { if( !isNeeded[k] ) continue; if( arr[k].r > dist(arr[k].x,arr[k].y,x,y) ) { isIncluded = true; break; } } if( !isIncluded ) { check = false; break; } } if( !check ) isNeeded[i] = true; } int count = 0; for(int i=0;i<n;i++) if( isNeeded[i] == false ) count++; printf("%d",count); }
#Verdict Execution timeMemoryGrader output
Fetching results...