In which type of case is the code failing?

I tried some test inputs and code seems to work. Which type of case am I missing?

https://www.codechef.com/viewsolution/49408197

Consider the test input:

3
1 11
6
4 9
9 8 1 6
2 10
10 5

and also consider not declaring (and initialising) all your variables at the top of main but only at the last possible point before you can use them! This eliminates the class of error that you’re making here.

Of all the anti-patterns I see in CP code, this is one of the strangest.

See e.g. this.

There’s another recent example here - are there some ancient professors teaching students to do this? :slight_smile:

1 Like

I got my mistake and links to the different threads really helped me. Thanks a lot!

1 Like