Rating changes for last rounds are temporarily rolled back. They will be returned soon. ×

Comments
On DevilCodeforces Round #659, 4 years ago
0

I'm a newbie. I didn't even understand the questions.

I am fairly new to this. so forgive me if I am wrong. but this code failed. and I don't understand why. I was quite proud when I had coded this one but got disappointed when the pretest failed. any help would be appreciated. ~~~~~ def game(stones): firstMove = True secondMove = False idx = 0 while idx < len(stones): if idx == len(stones) — 1 and stones[idx] == 0: if firstMove: print('Second') if secondMove: print('First') break if firstMove: if idx == len(stones) — 1: stones[idx] = 0 secondMove = True firstMove = False continue if stones[idx] == 1: stones[idx] = 0 idx += 1 secondMove = True

else:
            stones[idx] = 1
            secondMove = True
        firstMove = False
    if secondMove:
        if idx == len(stones) - 1:
            stones[idx] = 0
            secondMove = False
            firstMove = True
            continue
        if stones[idx] == 1:
            stones[idx] = 0
            idx += 1
            firstMove = True

        else:
            stones[idx] = 1
            firstMove = True
        secondMove = False

T = int(input()) for i in range(T): n = int(input()) stones = list(map(int, input().split())) game(stones)

~~~~~