I am trying to solv eproblem 442C I see other's code like http://mirror.codeforces.com/contest/442/submission/6971106 but i couldn't understand the logic of their code.I also read editorial of problem http://mirror.codeforces.com/blog/entry/12739
but i can not understand how it handle situations like 1 100 101 200 when the minimum is in the elements that we can not remove.
answer for 1 100 101 200 is equal to the answer of (0 99 100 199) + 2 so if the minimum is first or last remove it and make the answer += minimun*(n-2) and subtract the numbers see my code :D 6926204
Thanks for your explanation.I think it could be down without subtracting ?