Пожалуйста, прочтите новое правило об ограничении использования AI-инструментов. ×

Блог пользователя Vampire04

Автор Vampire04, история, 5 часов назад, По-английски

282767937

Problem link:https://codeforces.me/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.

  • Проголосовать: нравится
  • 0
  • Проголосовать: не нравится

»
4 часа назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

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.

  • »
    »
    4 часа назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    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!!

    • »
      »
      »
      3 часа назад, # ^ |
        Проголосовать: нравится 0 Проголосовать: не нравится

      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.