April LunchTime 2020 FFL Question WA Mystery

@admin CodeChef → Yesterday in April Lunchtime, I Submitted the below Solution for FFL Question and it gave me Wrong Answer in Contest:
[CodeChef: Practical coding for everyone]
(CodeChef: Practical coding for everyone)
Then, I Checked the Editorial and Found my and Tester Solution to be exactly Same, Then Why did I got Wrong answer??
I made the following Corrections:
1.) Removed all Commented Sentences
2.) Removed Extra integers Array(which I didn’t use)
3.) I Changed the min values from INT_MAX to 101
[CodeChef: Practical coding for everyone]
(CodeChef: Practical coding for everyone)
Now, it Gave Accepted, But I didn’t Noticed any major mistake in above code. Then why did my Code Fail?? Anyone who knows the Reason can also help me out. Thanks for Help!

You know, when there are no defenders or attackers, you are adding something to intmax, which will overflow and give you a negative number.

1 Like

Yes, Tried it …Got it Right!
https://www.codechef.com/viewsolution/32313636
I am Just a Begineer, So didn’t knew the hacks(i Heard it for Codeforces).
Thanks for Helping @everule1!!