Nasser's Card Game#13053

Nasser's Card Game (Editorial)

Nasser's Card Game

Simulate the game in sequence: a_1, b_1, a_2, b_2, \dots, a_n, b_n.

Iterate through from to and stop at the first match:

  • Fady wins if b_i = a_i.

  • Nasser wins if and a_i = b_{i-1}.

If no match occurs throughout all plays, output Tie.

Complexity: time per testcase.