Cod sursa(job #3137845)
Utilizator | Data | 15 iunie 2023 12:31:33 | |
---|---|---|---|
Problema | Hashuri | Scor | 0 |
Compilator | py | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
def fn():
fd = open("hashuri.in", "r")
fd_out = open("hashuri.out", "w")
hash = set()
for i in range(int(fd.readline())):
op, key = map(int, fd.readline().split(" "))
has_key = key in hash
if op == 1 and not has_key:
hash.add(key)
elif op == 2 and has_key:
hash.remove(key)
elif op == 3:
fd_out.write("%d\n" % int(has_key))
fn()