Skip to content

Commit

Permalink
Merge pull request #74 from AlgoLeadMe/21-alstjr7437
Browse files Browse the repository at this point in the history
21-alstjr7437
  • Loading branch information
tgyuuAn authored May 10, 2024
2 parents dbe6361 + f834f0d commit 1e75787
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 1 deletion.
3 changes: 2 additions & 1 deletion alstjr7437/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@
| 17์ฐจ์‹œ | 2024.03.16 | DP | <a href="https://www.acmicpc.net/problem/2228">๊ตฌ๊ฐ„ ๋‚˜๋ˆ„๊ธฐ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/61 |
| 18์ฐจ์‹œ | 2024.03.23 | ๋‹ค์ต์ŠคํŠธ๋ผ | <a href="https://www.acmicpc.net/problem/1753">์ตœ๋‹จ ๊ฒฝ๋กœ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/66 |
| 19์ฐจ์‹œ | 2024.03.27 | ๋ฌธ์ž์—ด | <a href="https://www.acmicpc.net/problem/5525">IOIOI</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/67 |
| 20์ฐจ์‹œ | 2024.04.03 | BFS | <a href="https://www.acmicpc.net/problem/1697">์ˆจ๋ฐ”๊ผญ์งˆ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 |
| 20์ฐจ์‹œ | 2024.04.03 | BFS | <a href="https://www.acmicpc.net/problem/1697">์ˆจ๋ฐ”๊ผญ์งˆ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/70 |
| 21์ฐจ์‹œ | 2024.04.06 | ๋น„ํŠธ๋งˆ์Šคํ‚น | <a href="https://www.acmicpc.net/problem/11723">์ง‘ํ•ฉ</a> | https://github.com/AlgoLeadMe/AlgoLeadMe-6/pull/74 |
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
import sys

input = sys.stdin.readline

m = int(input())

result = 0

for _ in range(m):
cmd = input().split()
print(result)

if cmd[0] == "add":
result |= (1 << int(cmd[1]))

if cmd[0] == "remove":
result &= ~(1 << int(cmd[1]))

if cmd[0] == "check":
if result & (1 << int(cmd[1])):
print(1)
else:
print(0)

if cmd[0] == "toggle":
result ^= (1 << int(cmd[1]))

if cmd[0] == "all":
result = (1 << 21) - 1

if cmd[0] == "empty":
result = 0


# for _ in range(m):
# cmd = input().split()

# if cmd[0] == "add":
# result[int(cmd[1])] = 1

# if cmd[0] == "remove":
# result[int(cmd[1])] = 0

# if cmd[0] == "check":
# if result[int(cmd[1])] == 1:
# print(1)
# else :
# print(0)

# if cmd[0] == "toggle":
# if result[int(cmd[1])] == 1:
# result[int(cmd[1])] = 0
# else :
# result[int(cmd[1])] = 1

# if cmd[0] == "all":
# result = [1] * len(result)

# if cmd[0] == "empty":
# result = [0] * len(result)

"""
S = set()
for _ in range(m):
temp = input().split()
if temp[0] == "add":
S.add(int(temp[1]))
if temp[0] == "remove":
S.discard(int(temp[1]))
if temp[0] == "check":
if int(temp[1]) in S:
print(1)
else :
print(0)
if temp[0] == "toggle":
if int(temp[1]) in S:
S.discard(int(temp[1]))
else:
S.add(int(temp[1]))
if temp[0] == "all":
S = set([i for i in range(1, 21)])
if temp[0] == "empty":
S = set()
"""

0 comments on commit 1e75787

Please sign in to comment.