https://codeforces.me/contest/1580/submission/130368106
The main idea is to choose the most optimal one number in every step.

Can anyone hack or prove the greedy solution of 1580D?
https://codeforces.me/contest/1580/submission/130368106
The main idea is to choose the most optimal one number in every step.
