Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- #define int long long
- signed main() {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cout.tie(0);
- int n, q;
- cin >> n >> q;
- int xornow = 0, am = 0;
- for (int i = 0; i < n; i++) {
- int a;
- cin >> a;
- xornow ^= a;
- am++;
- }
- while (q--) {
- int t;
- cin >> t;
- if (t == 3) {
- if (xornow == 0) {
- cout << am << "\n";
- }
- else {
- cout << 0 << "\n";
- }
- }
- else if (t == 2) {
- int x;
- cin >> x;
- xornow ^= x;
- am++;
- }
- else {
- int x;
- cin >> x;
- am--;
- xornow ^= x;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement