Two arcade rivals, Rin and Sol, face off on the same rhythm-game cabinet for n head-to-head rounds. In round i (0-indexed), a player's accuracy score is an integer from 0 to 10, where 10 marks a perfect combo. The cabinet's scoring rule works like this: for the first two rounds of the duel (i = 0 and i = 1), a player simply banks their raw accuracy score for that round. From round i = 2 onward, if either of the two rounds immediately before it (for that same player) was a perfect combo — a score of exactly 10 — the cabinet's overdrive multiplier activates and the current round's score counts double toward that player's running total; otherwise the round counts at face value. After all n rounds have been played, whichever player has the strictly higher total wins the duel.
Given both players' full round-by-round accuracy scores, determine the outcome of the duel.
Print a single integer: 1 if Rin's total is strictly higher, 2 if Sol's total is strictly higher, or 0 if both totals are equal.
Example 1
Input
4 5 10 3 2 6 5 7 3
Expected
1
Explanation
Rin (p1) = [5,10,3,2]: round0=5 (total 5), round1=10 (total 15), round2 doubles because round1 was 10 -> 3*2=6 (total 21), round3 doubles because round1 (two back) was 10 -> 2*2=4 (total 25). Sol (p2) = [6,5,7,3]: round0=6, round1=5 (total 11), round2 has no 10 in the previous two -> +7 (total 18), round3 has no 10 in the previous two -> +3 (total 21). Rin's 25 beats Sol's 21, so the answer is 1.
Example 2
Input
5 9 10 10 10 10 10 10 10 10 10
Expected
2
Explanation
Rin = [9,10,10,10,10] totals to 79: 9, +10=19, then rounds 2-4 all double (a 10 always sits in the previous two) giving +20 each -> 19+20+20+20=79. Sol = [10,10,10,10,10] totals to 80 by the same pattern: 10, +10=20, then +20 three times = 80. Sol's 80 beats Rin's 79, so the answer is 2.
Ready to solve this?
Sign in to open the editor, run your code against the sample tests, and submit against the full test suite.
Sign in to solve →