Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- #include <ext/rope>
- using namespace std;
- using namespace __gnu_cxx;
- random_device rd;
- mt19937 rnd(rd());
- #define pt pair<int, int>
- #define x first
- #define y second
- #define what_is(x) cerr << #x << " is " << x << endl;
- #define ok cerr << "ok" << endl;
- #define endl '\n'
- #define int long long
- #define ld long double
- const int N = 1e5 + 5;
- int a[2][N];
- signed main()
- {
- cin.tie(0), cout.tie(0), ios::sync_with_stdio(0);
- int n, q, cnt = 0;
- cin >> n >> q;
- while (q--)
- {
- int x, y;
- cin >> x >> y;
- --x, --y;
- if (a[x][y])
- {
- if (a[(x + 1) % 2][y]) --cnt;
- if (y > 0 && a[(x + 1) % 2][y - 1]) --cnt;
- if (y + 1 < n && a[(x + 1) % 2][y + 1]) --cnt;
- a[x][y] = 0;
- }
- else
- {
- if (a[(x + 1) % 2][y]) ++cnt;
- if (y > 0 && a[(x + 1) % 2][y - 1]) ++cnt;
- if (y + 1 < n && a[(x + 1) % 2][y + 1]) ++cnt;
- a[x][y] = 1;
- }
- if (cnt)
- cout << "No" << endl;
- else
- cout << "Yes" << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement