fork download
  1. tped, tsap = raw_input().split()
  2. tped = int(tped)
  3. tsap = int(tsap)
  4.  
  5. resp = []
  6.  
  7. def verifped(ped, total):
  8. a = 0
  9. while a < len(total):
  10. if ped == total[a]:
  11. return True
  12. else:
  13. a = a + 1
  14. if a == len(total):
  15. return False
  16.  
  17. while tsap > 0:
  18. sap = raw_input().split()
  19. sap[0] = int(sap[0])
  20. sap[1] = int(sap[1])
  21. if sap[0] + sap[1] <= tped:
  22. resp.append(sap[0]+sap[1])
  23. if sap[0] - sap[1] > 0:
  24. resp.append(sap[0]-sap[1])
  25. resp.append(sap[0])
  26. tsap = tsap - 1
  27.  
  28. x = 1
  29. while x <= tped:
  30. if verifped(x, resp) == True:
  31. print 1
  32. else:
  33. print 0
  34. x = x + 1
  35.  
  36.  
Success #stdin #stdout 0.02s 7260KB
stdin
5 2
3 2
4 4
stdout
1
0
1
1
1