Yath's blog

By Yath, history, 21 month(s) ago, In English

I am getting WA in Test case 2, particularly : wrong answer 35th numbers differ — expected: '1', found: '0'. I am unable to find the error in my code for this problem: 1622C - Set or Decrease My submission:193454039. The logic I used:

  • Vote: I like it
  • +3
  • Vote: I do not like it

»
21 month(s) ago, # |
Rev. 2   Vote: I like it +4 Vote: I do not like it

Hi Yath, there is a subtle mistake. The $$$x$$$ in your code is not guaranteed to be $$$ \leq v[0]$$$, so you should add a line x = min(x, v[0]) after the x-- line.

https://mirror.codeforces.com/contest/1622/submission/193539783

  • »
    »
    21 month(s) ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Yeah it solved it, Thank you!