Advertisement
Korotkodul

N5

Oct 25th, 2022 (edited)
627
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.94 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3. #include <vector>
  4. #include <queue>
  5. #include <algorithm>
  6. #include <string>
  7. #include <stack>
  8. #include <set>
  9. #include <map>
  10. #define pii pair <int, int>
  11. #define pb(x) push_back(x)
  12. using namespace std;
  13. using ll = long long;
  14. using ld = long double;
  15. using db = double;
  16. void cv(vector <int> &v) {
  17.     for (auto x : v) cout << x << ' ';
  18.     cout << "\n";
  19. }
  20.  
  21. void cvl(vector <ll> &v) {
  22.     for (auto x : v) cout << x << ' ';
  23.     cout << "\n";
  24. }
  25.  
  26.  
  27. void cvv(vector <vector <int> > &v) {
  28.     for (auto x : v) cv(x);
  29.     cout << "\n";
  30. }
  31.  
  32. void cvb(vector <bool> v) {
  33.     for (bool x : v) cout << x << ' ';
  34.     cout << "\n";
  35. }
  36.  
  37. void cvs(vector <string>  v) {
  38.     for (auto a : v) {
  39.         cout << a << "\n";
  40.     }
  41. }
  42.  
  43. void cvp(vector <pii> a) {
  44.     for (auto p : a) {
  45.         cout << p.first << ' ' << p.second << "\n";
  46.     }
  47.     cout << "\n";
  48. }
  49.  
  50. void cvch(vector <vector <char> > a) {
  51.     for (auto v: a) {
  52.         for (auto i: v) {
  53.             cout << i;
  54.         } cout << "\n";
  55.     } cout << "\n";
  56. }
  57.  
  58. int n, m, inf = 2e9;
  59.  
  60. struct rct {
  61.     int x1, x2, y1, y2;
  62.     void upd(int i, int j, int n, int m) {
  63.         int yi = n - 1;
  64.         int xj = j;
  65.         x1 = min(x1, xj);
  66.         x2 = max(x2, xj);
  67.         y1 = min(y1, yi);
  68.         y2 = max(y1, yi);
  69.     }
  70. };
  71.  
  72. rct getrec(vector <vector <int> > a) {
  73.     rct res = {inf, -1, inf, -1};
  74.     for (int i = 0; i < n; ++i) {
  75.         for (int j = 0; j < n; ++j) {
  76.             if (a[i][j] == 0) {
  77.                 res.upd(i, j, n, n);
  78.             }
  79.         }
  80.     }
  81.     return res;
  82. }
  83.  
  84. bool in(rct rec, int i, int j) {
  85.     int xj = j;
  86.     int yi = m - 1 - i;
  87.     return xj >= rec.x1
  88.     && xj <= rec.x2
  89.     && yi >= rec.y1
  90.     && yi <= rec.y2;
  91. }
  92.  
  93. bool noout(vector <vector <int> > a, int clr, rct rec) {
  94.     //n m global ok???
  95.     for (int i = 0; i < n; ++i) {
  96.         for (int j = 0; j < m; ++j) {
  97.             if (a[i][j] == clr) {
  98.                 if (!in(rec, i, j)) {
  99.                     return 0;
  100.                 }
  101.             }
  102.         }
  103.     }
  104.     return 1;
  105. }
  106. bool gen = 1;
  107.  
  108.  
  109. int main() {
  110.     /*ios::sync_with_stdio(0);
  111.     cin.tie(0);
  112.     cout.tie(0);*/
  113.     //cin >> n;
  114.     //m = n;
  115.     if (gen) {
  116.         vector <vector <char> > raw(13, vector <char> (13, '.'));
  117.         for (int i = 3; i <= 4; ++i) {
  118.             for (int j = 2; j <= 8; ++j) {
  119.                 raw[i][j] = '#';
  120.             }
  121.         }
  122.         for (int i = 5; i <= 8; ++i) {
  123.             for (int j = 2; j <= 4; ++j) {
  124.                 raw[i][j] = '#';
  125.             }
  126.         }
  127.         for (int i = 9; i <= 10; ++i) {
  128.             for (int j = 2; j <= 8; ++j) {
  129.                 raw[i][j] = '#';
  130.             }
  131.         }
  132.         cvch(raw);
  133.     }
  134. }
  135.  
  136. /*
  137. .............
  138. .............
  139. .............
  140. ..#######....
  141. ..#######....
  142. ..###........
  143. ..###........
  144. ..###........
  145. ..###........
  146. ..#######....
  147. ..#######....
  148. .............
  149. .............
  150. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement