PAST2I
https://gyazo.com/edc8d1afb55b0c9082e68b8470ffa0e0
PAST2I
対戦相手のIDが既知なら勝敗は定数オーダーでわかる
なので一回戦の勝者IDをキューに入れて二回戦ではそれを読めば良い
決勝戦を行う必要はないのでwhile len(winner) > 2
code:python
def solve(N, AS):
winner = list(range(2 ** N))
next_rank = 2
while len(winner) > 2:
next_winner = []
for i in range(0, len(winner), 2):
next_winner.append(a)
else:
next_winner.append(b)
winner = next_winner
next_rank += 1
return ranks