#P7339. Help Shido Become the Champion
Help Shido Become the Champion
Help Shido Become the Champion
The annual World Most Cute Contest has begun. Although Kotori, the former 'Cute King', is not participating, she wishes to help her brother Shido win the title of 'Fiery King'.
The contest features \(n=2^k\) contestants numbered \(1,2,\dots,n\), with Shido being contestant \(1\). The competition is held as a knockout tournament. At the beginning of each round, the remaining contestants are paired in order: the two with the smallest numbers face each other, then the next two, and so on. In each match, the winner is determined by the number of votes received. Every contestant receives votes equal to the number of members in their own fan club.
In addition, Kotori has a team of \(m\) members who always vote following her decision. For every match, she can add \(m\) extra votes to either of the two contestants. Moreover, if the votes are tied, Kotori gets to decide the outcome.
Each contestant \(i\) has a fan count \(a_i\). In a head-to-head match between contestants \(i\) and \(j\), Kotori can force contestant \(i\) to win if \(a_i + m \geq a_j\) by boosting him with the extra votes. Determine if Kotori can guarantee that her brother, contestant 1 (with fan count \(a_1\)), becomes the champion.
inputFormat
The first line contains two integers \(k\) and \(m\), where \(n=2^k\) is the number of contestants, and \(m\) is the number of extra votes Kotori can add in each match.
The second line contains \(n\) integers \(a_1, a_2, \dots, a_n\), where \(a_i\) is the fan count of the \(i\)th contestant.
outputFormat
Output Yes
if Kotori can help her brother become the champion; otherwise, output No
.
sample
1 5
10 14
Yes
</p>