REDALERT - Editorial

Solution: 50191108 | CodeChef
Why my solution is giving wrong answer ?

Consider the test input:

1
3 4 10
7 0 8