Advertisement
Guest User

Untitled

a guest
Jan 19th, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.84 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. //#include <ext/pb_ds/detail/standard_policies.hpp>
  4. //#include <ext/pb_ds/assoc_container.hpp>
  5. //#include <ext/pb_ds/tree_policy.hpp>
  6.  
  7. //#pragma GCC optimize("Ofast")
  8. //#pragma GCC target("sse,sse2,sse3,ssse3,sse4")
  9.  
  10. #define ll long long
  11. #define ld long double
  12. #define pb push_back
  13. #define F first
  14. #define S second
  15. #define endl '\n'
  16. //#define int long long
  17.  
  18. using namespace std;
  19.  
  20. //using namespace __gnu_pbds;
  21. //template <typename T> using ordered_set = tree <T, null_type, less < T >, rb_tree_tag, tree_order_statistics_node_update>;
  22.  
  23. const int N = 1e5 + 100;
  24. const int M = 22;
  25. const ll mod = 1e9 + 7;
  26. const ll MOD = 998244353;
  27. const int P = 1336;
  28. const ld eps = 0.000000001;
  29. const ll inf = 1e9 + 7;
  30.  
  31. //const int smi[8] = {-1, -2, -2, -1, 1, 2, 2, 1};
  32. //const int smj[8] = {-2, -1, 1, 2, 2, 1, -1, -2};
  33.  
  34. mt19937 gen(time(0));
  35.  
  36. int a[2][N];
  37.  
  38. int32_t main()
  39. {
  40. ios_base::sync_with_stdio(0);
  41. cin.tie(0);
  42. cout.tie(0);
  43.  
  44. //freopen("input.txt", "r", stdin);
  45. //freopen("output.txt", "w", stdout);
  46.  
  47. int n, q;
  48. cin >> n >> q;
  49. int k = 0;
  50. while (q--)
  51. {
  52. int x, y;
  53. cin >> x >> y;
  54. x--; y--;
  55. if (a[x][y] == 0)
  56. {
  57. a[x][y] = 1;
  58. int z = 0;
  59. if (x == 0) z = 1;
  60. if (a[z][y]) k++;
  61. else
  62. {
  63. if (y && a[z][y - 1]) k++;
  64. else if (a[z][y + 1]) k++;
  65. }
  66. }
  67. else
  68. {
  69. a[x][y] = 0;
  70. int z = 0;
  71. if (x == 0) z = 1;
  72. if (a[z][y]) k--;
  73. else
  74. {
  75. if (y && a[z][y - 1]) k--;
  76. else if (a[z][y + 1]) k--;
  77. }
  78. }
  79. if (k) cout << "No" << endl;
  80. else cout << "Yes" << endl;
  81. }
  82.  
  83. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement