Getting SIGTSTP error in DEPCHEF

Question :
Solution :

I am getting SIGTSTP error everytime I run it, Getting frustrated now.
I have no Idea why I am getting the error.
whats wrong with my code?
please help.

I submitted your code on Codechef. It didn’t give me any error, but it gave me Wrong Answer. I fixed it. Here it is- Fixed code.

Basically, the question says- "you want to help him pick a soldier for the king in such a way that the king receives the best shield(with the greatest defense value)."

In your code, you have printed the defence value of the first soldier who’ll stay alive, whereas you need to print the defense value of the soldier with the highest defence value who’ll stay alive.

Hope this helped. Feel free to ask if you have any more doubts :slight_smile: