Maximum Biotonic array

I’m getting tle in one of the cases. I unable to figure out where. My code in running on o(n).

Hey @sounakume it is possible that because of too many single for loops and large input size the largest case is overflowing the time limit. Please write

 ios_base::sync_with_stdio(false);
 cin.tie(NULL);

before int t;

what does this chunk of code do?

This code basically disables the synchronization between c and c++ standard streams and unties cin and cout.
So by default cin is slower than scanf in terms of taking input this speeds it up.

1 Like