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.
If
strength[i]>=str_ref && endurance[i]>=end_ref
holds, you quit thesolve
function without reading the rest of the testcase in. Then you callsolve()
again and read the continuation of the previous testcase as if it was the start of a new testcase. Chaos ensues.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!!
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 strength1
would work just fine, as Monocarp has higher endurance and is thus going to win.