-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
57 lines (43 loc) · 797 Bytes
/
main.cpp
File metadata and controls
57 lines (43 loc) · 797 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include <iostream>
#include <unordered_set>
#define MAX 100000
using namespace std;
int train[MAX+1] = {0};
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N, M, ans = 0;
unordered_set<int> s;
cin >> N >> M;
while(M--){
int op, i, x;
cin >> op;
switch(op){
case 1:
cin >> i >> x;
train[i] |= (1 << (x-1));
break;
case 2:
cin >> i >> x;
train[i] &= ~(1 << (x-1));
break;
case 3:
cin >> i;
train[i] = train[i] << 1;
train[i] &= ~(1 << 20);
break;
default:
cin >> i;
train[i] = train[i] >> 1;
break;
}
}
for(int i=1; i<=N; i++){
if(s.count(train[i]) == 0){
s.insert(train[i]);
ans++;
}
}
cout << ans;
return 0;
}