Codeforces Round #703 Guessing the Greatest - Binary search
Solution: Let's query $[1,n]$ firstly. And we get the index of 2nd largest value. Now we can get picture below:…
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.…
Solution: For all pairs of points, we sort it from largest to smallest. Query the reachability of the points with higher in-degree to lower in-degree in these pairs in turn.…
Solution: Just a very simple DP. The hardest part is understanding the problem description and understanding the sample data.…