Runtime Error (CHEFWORK)

https://www.codechef.com/viewsolution/28472853
Can anyone explain me why i am getting run time error , i noticed that it failed to pass
when input is all author-translator, test case 1 , and in some sub task of test case 2.

There is possibility that the vectors you created may be empty.
Therefore it is illegal to access there ‘0’ position, i.e. , tr[0]+au[0]>aut[0].
In other words it is not necessary that all of the three vectors contain elements some of them may be empty.

1 Like

Then is there any way to counter this error, i mean in this solution ?

If au or tr is empty then aut[0] is ans.
if aut is empty then au[0]+tr[0] is ans.
else the condition already present in code.
PS- Make a habit of debugging code yourself.

3 Likes

I tried myself to debug it, but i was unable to do it , so i come here , by the way thanks for the help. <3