Untitled
unknown
python
4 years ago
1.6 kB
7
Indexable
if __name__ == "__main__": tt = int(input()) for _ in range(0, tt): N = int(input()) alice_score, bob_score = 0, 0 die1, die2 = 0, 0 state = 0 score_equal = False # check if score has been equal yet # state 0 | when alice has die 1 and bob has die 2 # state 1 | when alice has die 2 and bob has die 1 for roound in range(0, N): # alice and bob score in each round x, y = map(int, input().split()) alice_score += x bob_score += y if state == 0: die1 += x die2 += y if state == 1: die1 += y die2 += x if alice_score == bob_score and score_equal == False: # Both of there scores is equal # Reset die scores to 0 score_equal = True die1 = 0 die2 = 0 if alice_score != bob_score and score_equal == True: continue if alice_score != bob_score and score_equal == False: if state == 1: state = 0 else: state = 1 if die1 > die2: print(1) else: print(2)
Editor is loading...