1241 - Jollybee Tournament


Difficulty : easy

Solution Description :

Ad hoc problem

for input
3 5
1 2 3 4 5

Set 0 for all withdrawn player and 1 for other player.

1:0--|
     |---0
2:0--|   |
         |---0
3:0--|   |   |
     |---0   |
4:0--|       | 
             |----1
5:0--|       |
     |---1   |
6:1--|   |   |
         |---1
7:1--|   | 
     |---1
8:1--|

For 0 & 1 and 1 & 1 combination set 1, for 0 & 0 combination set 0.
If you got 0 & 1 combination then it is a w/o match increment counter.