Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
nums = [int(x) for x in input().split()]
N,M = nums[0],nums[1]
imos = [0 for i in range(N+1)]
V = 0
for i in range(M):
nums = [int(x) for x in input().split()]
a,b = nums[0]-1,nums[1]-1
imos[a] += 1
imos[b+1] -= 1
ans = []
j = 0
for i in imos:
ans.append(j+i)
j += i
ans = ans[:N]
ans = [0 for x in ans if x % 2 == 0 else 1]
print(ans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment