Page 1 of 1

Possibly wrong author's solution for DCP-301 Balanced array

PostPosted: Tue Jan 09, 2018 12:01 am
by feodorv
Seems the autor's solution for "DCP-301: Balanced array" used to generate judge output is wrong.

It does not take into account cases when the second reparing change (as the answer to the query) occurs before the first query change. I mean the input cases like

1
4
-5 -5 5 5
1
3

where we can restore ballancing quality by means of changing the sign of array element with index #2: -5 5 -5 5.

If we eliminate such possibility then we get AC on submitting. But this is not correct i think. There is nothing in problem description which forces us to eliminate such cases.