In Jollybee Chess Championship 2008, there are a number of players who have withdrawn themselves from the championship of 64 players (in this problem, we generalized it into 2N
If both players are available then there will be a normal match, one of them will advance to the next phase. If only one player is available then there will be a walkover match, and he/she will automatically advance. If no player is available then there will be no match.
In the left figure, the player #3 and #4 are withdrawn from the tournament, leaving a total of one w/o match (at match #3).
Given the list of players who withdraw right before the tournament start, calculate how many w/o matches to happen in the whole tournament, assuming that all of the remaining players play until the end of the tournament (winning or knocked-out).
The first line of input contains an integer T
$(1 \le N \le 10)$
-->
(1
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/637-2.png"
ALT="$ \le$">N
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/637-2.png"
ALT="$ \le$">10)
$(0 \le M \le 2N)$
-->
(0
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/637-2.png"
ALT="$ \le$">M
WIDTH="18" HEIGHT="31" ALIGN="MIDDLE" BORDER="0"
SRC="/ntujudge/problemdata/637-2.png"
ALT="$ \le$">2N)
For each case, print in a single line containing the number of walkover matches.
3
2 2
3 4
3 5
1 2 3 4 5
2 1
2
1
2
1
Migrated from old NTUJ.
ACM ICPC regional Jakarta site 2008
No. | Testdata Range | Score |
---|