8000
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cbcd96f commit 94e3653Copy full SHA for 94e3653
Appendix C/solutions/11723.cpp
@@ -0,0 +1,42 @@
1
+// Authored by : BaaaaaaaaaaarkingDog
2
+// Co-authored by : -
3
+// http://boj.kr/5d6d3f1b55a04ea2a5bab1e7b9e28684
4
+#include <bits/stdc++.h>
5
+using namespace std;
6
+
7
+int state;
8
9
+int main(){
10
+ ios::sync_with_stdio(0);
11
+ cin.tie(0);
12
13
+ int m;
14
+ cin >> m;
15
+ while(m--){
16
+ string com;
17
+ int x;
18
+ cin >> com;
19
+ if(com == "add"){
20
+ cin >> x;
21
+ state |= (1 << (x-1));
22
+ }
23
+ else if(com == "remove"){
24
25
+ state &= (~(1 << (x-1)));
26
27
+ else if(com == "check"){
28
29
+ cout << ((state >> (x-1)) & 1) << '\n';
30
31
+ else if(com == "toggle"){
32
33
+ state ^= (1 << (x-1));
34
35
+ else if(com == "all"){
36
+ state = 0xfffff;
37
38
+ else{ // empty
39
+ state = 0;
40
41
42
+}
0 commit comments