Codeforces Round #723 Potions (Hard/Easy) Solution (Java/C++)
Solution: First, if there are not any limitations, we will drink all the potions. In fact, the only limitation is the health must not less than 0.…
Solution: First, if there are not any limitations, we will drink all the potions. In fact, the only limitation is the health must not less than 0.…
Solution: Let consider how Anton fix the DNS. We found that: for minimum cost, every time, Anton just fixing one character. For example, fix NNOTA to ANTON.…
A. Eshag Loves Big Arrays Solution: Because can choose any subsequence. So, for some number x which is bigger than the minimum number of the array.…
Solution: The first conclusion is: for any vertex, it will choose l or r. Because if and only if the case like example 2 can choose value between l and r…
Solution: Define dp[i] to represent the answer when n=i. We use the case n=4 to explain the solution.…
Solution: Use the node 0 as the root of tree. For each node, calculate the total number of children nodes (include itself) by DFS. Denote by "count".…
Solution: We put the same numbers together. Then we get the index array of same numbers. For example, for [1,2,1,1], we put same number together, so, we get: [0,2,3] and [1].…
Solution: 1: Consider the simplest case: the string is palindrome, and the length of string is even. For example, 000000. For this case, Bob must win.…