fork download
  1. //https://c...content-available-to-author-only...s.com/group/c3FDl9EUi9/contest/267312/problem/B
  2.  
  3.  
  4.  
  5.  
  6.  
  7. /*
  8.  =========================
  9.   M.NABEH
  10.   "The thrill of the code..."
  11.   WA makes it more fun
  12.  =========================
  13. */
  14.  
  15. #include <iostream>
  16. #include <algorithm>
  17. #include <string>
  18. #include <vector>
  19. #include <queue>
  20. #include <deque>
  21. #include <stack>
  22. #include <set>
  23. #include <cmath>
  24. #include <numeric>
  25. #include <map>
  26. #include <bitset>
  27. #include <iterator>
  28. #include <iomanip>
  29. using namespace std;
  30.  
  31. // ---------- Macros ----------
  32. #define pb push_back
  33. #define all(x) (x).begin(), (x).end()
  34. #define rall(x) (x).rbegin(), (x).rend()
  35. #define All(x) (x).begin()+1, (x).end()
  36. #define rAll(x) (x).rbegin(), (x).rend()-1
  37. #define Sz(x) (int)(x).size()-1
  38. #define el '\n'
  39. #define F first
  40. #define S second
  41. #define see_u_later return 0 // see u later :)
  42.  
  43. // ---------- Constants ----------
  44. const long long INF = 1e18;
  45. const double PI = acos(-1.0);
  46. const double EPS = 1e-9;
  47.  
  48. // ---------- Type Aliases ----------
  49. using ll = long long;
  50. using ld = long double;
  51. using pii = pair<int,int>;
  52. using pll = pair<long long,long long>;
  53. using vi = vector<int>;
  54. using vll = vector<long long>;
  55. using vpii = vector<pair<int,int> >;
  56. using vpll = vector<pair<long long,long long> >;
  57. using vpil = vector<pair<int,long long> >;
  58. using vpcl = vector<pair<char,long long> >;
  59. using vplc = vector<pair<long long,char> >;
  60.  
  61. // ---------- Functions ----------
  62. const ll MOD = 1e9 + 7;
  63. ll power(ll a, ll b)
  64. {
  65. ll res = 1;
  66. while (b)
  67. {
  68. if (b & 1) res = res * a % MOD;
  69. a = a * a % MOD;
  70. b >>= 1;
  71. }
  72. return res;
  73. }
  74. void Remy() {
  75. int n,q;
  76. cin>>q>>n;
  77. while(q--){
  78. ll ty;
  79. cin>>ty;
  80. if(ty==1){
  81.  
  82. int x;
  83. cin>>x;
  84. if (n & (1 << x)) cout << 1 << el;
  85. else cout << 0 << el;}
  86. else if(ty==2){
  87. int x;
  88. cin>>x;
  89. n|=(1<<x);
  90. cout<<n<<el;
  91. }
  92. else if(ty==3){
  93. int x;
  94. cin>>x;
  95. n&=~(1<<x);
  96. cout<<n<<el;
  97. }
  98. else if(ty==4){
  99. int x;
  100. cin>>x;
  101. n^=(1<<x);
  102. cout<<n<<el;
  103. }
  104.  
  105. }
  106.  
  107.  
  108.  
  109.  
  110.  
  111. }
  112.  
  113. int main() {
  114. ios::sync_with_stdio(false);
  115. cin.tie(NULL);
  116.  
  117. int t = 1;
  118. //cin >> t;
  119. while (t--) {
  120. Remy();
  121. }
  122.  
  123. see_u_later;
  124. }
Success #stdin #stdout 4.84s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty