Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from copy import deepcopy
- def calc_xor(sp):
- mxor = 0
- for x in sp:
- mxor ^= x
- return mxor
- sp = [int(x) for x in input().split()]
- p = 0
- while sum(sp) > 0:
- if p == 0:
- copy_sp = deepcopy(sp)
- f = False
- for i in range(len(copy_sp)):
- if f:
- break
- for val in range(0, copy_sp[i] + 1):
- copy_sp[i] = val
- xxor = calc_xor(copy_sp)
- if xxor == 0:
- f = True
- # left this many rocks
- print(i, val)
- sp = copy_sp
- break
- p += 1
- else:
- # bot turn in format heap[i] = val (i,x)
- i, x = [int(x) for x in input().split()]
- sp[i] = x
- p -= 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement