1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
#include <iostream> #include <cstdio> using namespace std; struct router{ int x,y,r; }; struct location{ int x,y; }; router rr[105]; location loc[12]; int main() { int t,kase=1; int a,b,c,d,e; bool f,found; cin>>t; int routers,locations; while(t--) { cin>>routers>>locations; f=0; for(int i=0;i<routers;i++) { cin>>rr[i].x>>rr[i].y>>rr[i].r; } for(int i=0;i<locations;i++) { cin>>loc[i].x>>loc[i].y; } for(int i=0;i<locations;i++) { a=loc[i].x;b=loc[i].y; found=0; for(int j=0;j<routers;j++) { c=rr[j].x; d=rr[j].y; e=rr[j].r; e*=e; //cout<<"e "<<c<<" "<<d<<" "<<e<<"\n"; if((a-c)*(a-c)+(b-d)*(b-d)<=e) { if(!f) cout<<"Case "<<kase++<<":\n"; f=1; cout<<"Yes\n"; found=1; break; } } if(!found) { if(!f) cout<<"Case "<<kase++<<":\n"; f=1; cout<<"No\n"; } } } return 0; } |