Codeforces Round #717 Baby Ehab Partitions Again - Math+01 Knapsack problem
Solution Define $sum=\sum_{i=1}^n a_i$. If $sum$ is a odd number, then of course no need remove anything.…
Solution Define $sum=\sum_{i=1}^n a_i$. If $sum$ is a odd number, then of course no need remove anything.…
Solution: If the XOR sum of all numbers is 0. Then it must can make it. Because if and only if a[1]⊕a[2]⊕...⊕a[n−1]=a[n], the XOR sum is 0. So we can make the array as: (a[n],a[n]).…
Solution: Let's query $[1,n]$ firstly. And we get the index of 2nd largest value. Now we can get picture below:…
A. Domino on Windowsill Solution: Place the domino upright in vertical is fine. Then place in horizontal for the extra part.…
Solutions: It is very simple to prove that the string which length is 3n can be obtained. Let's get two string which length is 2n, one is 000000, another one is 111111.…
A. Average Height Solutions: Put all odd number together. And then put all even number together. Code:…
Solution: Sort $a$ first. We can easily find that on any day, the members inside must be a continuous segment of $a$.…
Solution: Generally, Get the total number of almost sorted permutations of length $l$ by DP. And continuously split $n$ and $k$ into sub-DPs.…