Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Source #671626:
- #include<stdio.h>
- int room[1010][1010];
- int main()
- {
- int n,m;
- scanf("%d %d",&n,&m);
- for(int i=0;i<n;i++){
- int x,y;
- scanf("%d %d",&x,&y);
- room[y][x] = 1;
- }
- for(int i=0;i<m;i++){
- int x,y,r;
- scanf("%d %d %d",&x,&y,&r);
- int count = 0;
- for(int Y = y-r;Y <= y + r ; Y++){
- for(int X = x-r ; X <= x + r ; X++){
- if(Y < 0 || Y > 1000 || X < 0 || X > 1000)continue;
- // printf("Test %d %d\n",X,Y);
- if( room[Y][X] == 1){
- room[Y][X] = 0;
- count++;
- }
- }
- }
- printf("%d\n",count);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment