-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQ1T.cpp
More file actions
48 lines (41 loc) · 702 Bytes
/
Copy pathQ1T.cpp
File metadata and controls
48 lines (41 loc) · 702 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
//
// Created by Rajaz on 3/2/17.
//
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <algorithm>
#include <cstring>
#include <math.h>
#include <string>
using namespace std;
int main(){
ios::sync_with_stdio(false);
int N,k;
string str;
cin >> N;
bool x[1<<16];
memset(x,false,1<<16);
while(N--){
scanf("%s %d", &str[0], &k);
int ans = 0;
switch(str[0]){
case 'c':
for(int i=0;i<16;i++){
if(((k>>i)&1) && x[k^ (1<<i)] )
ans++;
}
if(x[k])ans++;
cout << ans << endl;
break;
case 'd':
x[k] = false;
break;
case 'a':
x[k] = true;
break;
}
}
return 0;
}