Cod sursa(job #247054)

Utilizator wickedmanCristian Strat wickedman Data 22 ianuarie 2009 02:08:42
Problema Hashuri Scor 100
Compilator py Status done
Runda Arhiva educationala Marime 0.33 kb
fd = open("hashuri.in", "r")
fd_out = open("hashuri.out", "w")
hash = set()
for i in xrange(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))