Pagini recente » Cod sursa (job #2550714) | Cod sursa (job #677725) | Cod sursa (job #2065824) | Cod sursa (job #2044087) | Cod sursa (job #247055)
Cod sursa(job #247055)
lines = open("hashuri.in", "r").readlines()
buffer_out = []
hash = set()
for line in lines[1:]:
op, key = map(int, line.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:
buffer_out.append("%d" % int(has_key))
open("hashuri.out", "w").write("\n".join(buffer_out))