fork download
  1. #include <iostream>
  2. #include<cmath>
  3. #include<algorithm>
  4. #include<string>
  5. #include<vector>
  6. #include<deque>
  7. #include<stack>
  8. #include<queue>
  9. #include<map>
  10. #include<set>
  11. using namespace std;
  12. int main() {
  13.  
  14. cin.tie(NULL);
  15. cout.tie(NULL);
  16. ios_base::sync_with_stdio(false);
  17. int q, n;
  18. cin>>q>>n;
  19. while(q--){
  20. int id;
  21. cin>>id;
  22. int x;
  23. if(id == 1){
  24. cin>>x;
  25. n = n | x; // n|=x;
  26. }
  27. else if(id == 2){
  28. cin>>x;
  29. n = n & x; //
  30. }
  31. else if(id == 3){
  32. cin>>x;
  33. n = n ^ x;
  34. }
  35. else{
  36. n = ~n;
  37. }
  38. cout<<n<<endl;
  39. }
  40. }
Success #stdin #stdout 0.01s 5284KB
stdin
Standard input is empty
stdout
-1
0