Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- //#include <ext/pb_ds/detail/standard_policies.hpp>
- //#include <ext/pb_ds/assoc_container.hpp>
- //#include <ext/pb_ds/tree_policy.hpp>
- //#pragma GCC optimize("Ofast")
- //#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
- #define ll long long
- #define ld long double
- #define pb push_back
- #define F first
- #define S second
- #define endl '\n'
- //#define int long long
- using namespace std;
- //using namespace __gnu_pbds;
- //template <typename T> using ordered_set = tree <T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update>;
- const int N = 1e5 + 100;
- const int M = 22;
- const ll mod = 1e9 + 7;
- const ll MOD = 998244353;
- const int P = 1336;
- const ld eps = 0.000000001;
- const ll inf = 1e9 + 7;
- //const int smi[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
- //const int smj[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
- mt19937 gen(time(0));
- int a[2][N];
- int32_t main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- //freopen("input.txt", "r", stdin);
- //freopen("output.txt", "w", stdout);
- int n, q;
- cin >> n >> q;
- int k = 0;
- while (q--)
- {
- int x, y;
- cin >> x >> y;
- x--; y--;
- if (a[x][y] == 0)
- {
- a[x][y] = 1;
- int z = 0;
- if (x == 0) z = 1;
- if (a[z][y]) k++;
- else
- {
- if (y && a[z][y - 1]) k++;
- else if (a[z][y + 1]) k++;
- }
- }
- else
- {
- a[x][y] = 0;
- int z = 0;
- if (x == 0) z = 1;
- if (a[z][y]) k--;
- else
- {
- if (y && a[z][y - 1]) k--;
- else if (a[z][y + 1]) k--;
- }
- }
- if (k) cout << "No" << endl;
- else cout << "Yes" << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement