xT30x

Untitled

Oct 26th, 2022
712
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.10 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4. using ll = long long;
  5. using ld = long double;
  6.  
  7. int main()
  8. {
  9.     ll x, y;
  10.     cin >> x >> y;
  11.     vector<vector<ll>> z1(x, vector<ll>(y));
  12.     ll n;
  13.     map<ll, pair<ll, ll>> id;
  14.     map<ll, pair<char, ll>> dr;
  15.     ll i1, x1, y1, l1;
  16.     char d1;
  17.     while (n-- > 0)
  18.     {
  19.         cin >> i1 >> d1 >> x1 >> y1 >> l1;
  20.         z1[i1] = {x1, y1};
  21.         dr[i1] = {d1, l1};
  22.         if (d1 == 'h')
  23.         {
  24.             for (int i = x1; i < 100; i++)
  25.             {
  26.                 z1.at(i).at(y1)++;
  27.                 l1--;
  28.                 if (l1 == 0)
  29.                 {
  30.                     break;
  31.                 }
  32.             }
  33.         }
  34.         else
  35.         {
  36.             for (int i = y1; i < 100; i++)
  37.             {
  38.                 z1.at(x1).at(i)++;
  39.                 l1--;
  40.                 if (l1 == 0)
  41.                 {
  42.                     break;
  43.                 }
  44.             }
  45.         }
  46.     }
  47.     ll in, st;
  48.     cin >> in >> st;
  49.     x1 = id[in].first;
  50.     y1 = id[in].second;
  51.     d1 = dr[in].first;
  52.     l1 = dr[in].second;
  53.     bool a = true;
  54.     if (d1 == 'h')
  55.     {
  56.         if (!y1 + st < y)
  57.         {
  58.             cout << "true";
  59.             a = false;
  60.         }
  61.     }
  62.     else
  63.     {
  64.  
  65.         if (!x1 + st < x)
  66.         {
  67.             cout << "true";
  68.             a = false;
  69.         }
  70.     }
  71.     if (a)
  72.     {
  73.         while (st-- > 0)
  74.         {
  75.             for (auto &c1 : z1)
  76.             {
  77.                 for (auto &c2 : c1)
  78.                 {
  79.  
  80.                     if (c2 == 2)
  81.                     {
  82.                         cout << "true";
  83.                         return 0;
  84.                     }
  85.                 }
  86.             }
  87.             if (d1 == 'h')
  88.             {
  89.                 z1.at(x1).at(y1) = 0;
  90.                 z1.at(x1).at(y1 + l1) = 1;
  91.                 y1 += 1;
  92.             }
  93.             else
  94.             {
  95.  
  96.                 z1.at(x1).at(y1) = 0;
  97.                 z1.at(x1 += l1).at(y1) = 1;
  98.                 x1 += 1;
  99.             }
  100.         }
  101.         cout << "false";
  102.     }
  103.  
  104.     return 0;
  105. }
  106.  
Advertisement
Add Comment
Please, Sign In to add comment