Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- using ll = long long;
- using ld = long double;
- int main()
- {
- ll x, y;
- cin >> x >> y;
- vector<vector<ll>> z1(x, vector<ll>(y));
- ll n;
- map<ll, pair<ll, ll>> id;
- map<ll, pair<char, ll>> dr;
- ll i1, x1, y1, l1;
- char d1;
- while (n-- > 0)
- {
- cin >> i1 >> d1 >> x1 >> y1 >> l1;
- z1[i1] = {x1, y1};
- dr[i1] = {d1, l1};
- if (d1 == 'h')
- {
- for (int i = x1; i < 100; i++)
- {
- z1.at(i).at(y1)++;
- l1--;
- if (l1 == 0)
- {
- break;
- }
- }
- }
- else
- {
- for (int i = y1; i < 100; i++)
- {
- z1.at(x1).at(i)++;
- l1--;
- if (l1 == 0)
- {
- break;
- }
- }
- }
- }
- ll in, st;
- cin >> in >> st;
- x1 = id[in].first;
- y1 = id[in].second;
- d1 = dr[in].first;
- l1 = dr[in].second;
- bool a = true;
- if (d1 == 'h')
- {
- if (!y1 + st < y)
- {
- cout << "true";
- a = false;
- }
- }
- else
- {
- if (!x1 + st < x)
- {
- cout << "true";
- a = false;
- }
- }
- if (a)
- {
- while (st-- > 0)
- {
- for (auto &c1 : z1)
- {
- for (auto &c2 : c1)
- {
- if (c2 == 2)
- {
- cout << "true";
- return 0;
- }
- }
- }
- if (d1 == 'h')
- {
- z1.at(x1).at(y1) = 0;
- z1.at(x1).at(y1 + l1) = 1;
- y1 += 1;
- }
- else
- {
- z1.at(x1).at(y1) = 0;
- z1.at(x1 += l1).at(y1) = 1;
- x1 += 1;
- }
- }
- cout << "false";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment