a.rjput's blog

By a.rjput, history, 5 weeks ago, In English

Hi, I tried wrote the program for this problem and on CF testing it seems to be failing on 27th test case of 2nd test i.e.

4
0 -2 1 2

In my local this is giving the correct answer i.e.

1 0

On CF, the answer is coming as 2 0 for some reason. Not able to figure out the reason, any help would be appreciated!!

Below is the submission of the same:

https://codeforces.net/contest/1660/submission/263742365

  • Vote: I like it
  • 0
  • Vote: I do not like it

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by a.rjput (previous revision, new revision, compare).

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

If you remove 1 at the front and 0 at the back, the product will be -4. On the other hand, if you remove 2 at the front and 0 at the back the product will be 2, which is bigger.

»
5 weeks ago, # |
  Vote: I like it 0 Vote: I do not like it

just look at the global variables which you have declared , carefully . there might be the case that your code is using values of some other previous test case.(test case 2 is using values of test case 1 which might be causing the issue).