Advertisement
Guest User

111

a guest
Dec 13th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.68 KB | None | 0 0
  1. #include<iostream>
  2. #include<cmath>
  3. #include<cstring>
  4. #include<algorithm>
  5. using namespace std;
  6. int a[510][510] = { 0 };
  7. int main() {
  8.     int n;
  9.     int flag = 0;
  10.     int judge, x1, x2, y1, y2;
  11.  
  12.  
  13.     cin >> n;
  14.     for (int x = 0; x < n; x++) {
  15.         cin >> judge >> x1 >> y1 >> x2 >> y2;
  16.         if (judge == 1) {
  17.             for (int i = x1; i <= x2; i++) {
  18.                 for (int j = y1; j <= y2; j++) {
  19.                     if (a[i][j] == 0) {
  20.                         flag = 1;
  21.                         break;
  22.                     }
  23.                 }
  24.             }
  25.             if (flag == 1) {
  26.                 cout << "No" << endl;
  27.             }
  28.             else {
  29.                 cout << "Yes" << endl;
  30.             }
  31.         }
  32.         else {
  33.             for (int i = x1; i <= x2; i++) {
  34.                 for (int j = y1; j <= y2; j++) {
  35.                     a[i][j] = 1;
  36.                 }
  37.             }
  38.         }
  39.     }
  40.     return 0;
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement