Advertisement
mickypinata

PROG-T1071: Bomb

Mar 25th, 2020
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.79 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. bool table[1010][1010];
  5.  
  6. int nb, n;
  7.  
  8. int main(){
  9.  
  10.     int x, y, r, cnt;
  11.  
  12.     scanf("%d %d", &n, &nb);
  13.     for(int i = 0; i < n; ++i){
  14.         scanf("%d %d", &x, &y);
  15.         table[x][y] = true;
  16.     }
  17.     for(int i = 0; i < nb; ++i){
  18.         scanf("%d %d %d", &x, &y, &r);
  19.         cnt = 0;
  20.         for(int j = x - r; j <= x + r; ++j){
  21.             if(j >= 0 && j <= 1000){
  22.                 for(int k = y - r; k <= y + r; ++k){
  23.                     if(k >= 0 && k <= 1000){
  24.                         if(table[j][k]){
  25.                             table[j][k] = false;
  26.                             ++cnt;
  27.                         }
  28.                     }
  29.                 }
  30.             }
  31.         }
  32.         cout << cnt << "\n";
  33.     }
  34.  
  35.     return 0;
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement