Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- typedef long long ll;
- typedef unsigned long long ull;
- typedef long double ld;
- #define pb push_back
- #define X first
- #define Y second
- const ll mod = 998244353;
- using namespace std;
- ll n, q, a[4][100002], is[100002], ans, r, c;
- ll check(ll x)
- {
- if (x == 0 || x == n) return 0;
- if (a[1][x] == 0 && a[1][x+1] == 0 || a[2][x] == 0 && a[2][x+1] == 0) return 0;
- else return 1;
- }
- int main()
- {
- cin >> n >> q;
- while(q--)
- {
- cin >> r >> c;
- a[r][c] = !a[r][c];
- ans = ans - is[c-1] + check(c-1);
- is[c-1] = check(c-1);
- ans = ans - is[c] + check(c);
- is[c] = check(c);
- if (ans == 0) cout << "Yes";
- else cout << "No";
- cout << endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement