Please read the new rule regarding the restriction on the use of AI tools. ×

Vampire04's blog

By Vampire04, history, 3 hours ago, In English

282767937

Problem link:https://codeforces.net/contest/1879/problem/A On submitting the code, I got run time error on test case 2 but I ran the same code on an online compiler and was able to get the output. Kindly point out my errors and help me rectify them. Thank You.

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

»
3 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

If strength[i]>=str_ref && endurance[i]>=end_ref holds, you quit the solve function without reading the rest of the testcase in. Then you call solve() again and read the continuation of the previous testcase as if it was the start of a new testcase. Chaos ensues.

  • »
    »
    105 minutes ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    282780258 I am really sorry for asking this..I just submitted my code but am now getting a WA..Could you please take a look and tell me where I am going wrong..Also thanks a lot for helping out this newbie!!

    • »
      »
      »
      95 minutes ago, # ^ |
        Vote: I like it 0 Vote: I do not like it

      It is possible that an athlete has more strength than Monocarp, but less endurance. If there's e.g. just one such athlete, you're going to have ans == INT_MIN and hence output -1. But in fact strength 1 would work just fine, as Monocarp has higher endurance and is thus going to win.