A. Mean Inequality
Solution:
Sort the array. And split the array to two parts. Each time, we take one number from each of the two parts at a time.
![](https://zh.xloypaypa.pub/content/images/2021/05/image-15.png)
Code:
Java
![](https://codeforces.org/s/42756/images/codeforces-telegram-square.png)
C++
![](https://codeforces.org/s/42756/images/codeforces-telegram-square.png)
B. I Hate 1111
Solution:
Consider 1111, we found that $1111=11\times 101$. In same way, we only need consider if the number can be built by 11 and 111.
Let $x=a\cdot 11 + b\cdot 111$. when $b>11$, $x=a\cdot 11 + 11 \cdot 111 + (b-11)\cdot 111=(a+111)\cdot 11 + (b-11) \cdot 111$. So, if there is a solution, then we must can find the solution which $b<11$. So, just enumerate the b.
Code:
Java
![](https://codeforces.org/s/42756/images/codeforces-telegram-square.png)
C++
![](https://codeforces.org/s/42756/images/codeforces-telegram-square.png)
C. Potions
Tried to find some $n^2$ solution, so that can pass easy version only. But I cannot find that.
And for this problem, it is obviously, just calculating the prefix sum. When the sum is less than 0, we spit the worst potion.
![](https://codeforces.org/s/84159/android-icon-192x192.png)
D. Kill Anton
The conclusion is: in the answer, the four letters must be consecutive. So just enumerate the permutation of four letters and see which one can make largest cost.
![](https://codeforces.org/s/42756/android-icon-192x192.png)
E. Oolimry and Suffix Array
After I build the 4th sample data, then this problem is solved. The point is: find out the way to handle the case which string have duplicate character.
![](https://codeforces.org/s/88182/android-icon-192x192.png)