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

Dev Skill archived problems can be discussed here.

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

by feodorv » Tue Jan 09, 2018 12:01 am

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.
 
Posts: 11
Joined: Thu Jun 15, 2017 3:37 pm

Who is online
Users browsing this forum: No registered users and 0 guests
cron