SuitNdtie

Bomb PROG1071

Mar 30th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. Source #671626:
  2. #include<stdio.h>
  3.  
  4. int room[1010][1010];
  5.  
  6. int main()
  7. {
  8.     int n,m;
  9.     scanf("%d %d",&n,&m);
  10.     for(int i=0;i<n;i++){
  11.         int x,y;
  12.         scanf("%d %d",&x,&y);
  13.         room[y][x] = 1;
  14.     }
  15.     for(int i=0;i<m;i++){
  16.         int x,y,r;
  17.         scanf("%d %d %d",&x,&y,&r);
  18.         int count = 0;
  19.         for(int Y = y-r;Y <= y + r ; Y++){
  20.             for(int X = x-r ; X <= x + r ; X++){
  21.                 if(Y < 0 || Y > 1000 || X < 0 || X > 1000)continue;
  22.             //  printf("Test %d %d\n",X,Y);
  23.                 if( room[Y][X] == 1){
  24.                     room[Y][X] = 0;
  25.                     count++;
  26.                 }
  27.             }
  28.         }
  29.         printf("%d\n",count);
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment