Skip to content

Instantly share code, notes, and snippets.

@ria3100
Last active April 26, 2016 07:51
Show Gist options
  • Save ria3100/bfce602fa49a251e9eb710038d1fc730 to your computer and use it in GitHub Desktop.
Save ria3100/bfce602fa49a251e9eb710038d1fc730 to your computer and use it in GitHub Desktop.
AtCoder C - オセロ
# coding: utf-8
# http://abc035.contest.atcoder.jp/tasks/abc035_c
N, Q = map(int, input().split())
piece = 0b0
for _ in range(Q):
l, r = map(int, input().split())
tmp = ['1' if l <= x <= r else '0' for x in range(1, N+1)]
tmp = int(''.join(tmp), 2)
piece = int(bin(tmp ^ piece), 2)
print(str(format(piece, 'b')).zfill(N))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment