Help Martha TLE

I used fast IO too, but still got TLE again and again. Even used int in place of long long.

Problem

Code

Please anyone help , why is it so.

I have seen solutions with even more if-else conditions that passed the test cases .

endl is very slow while printing strings, use ā€œ\nā€. Comparison Between endl and \n in C++ - Codeforcesā€™%20instead%20of%20endl.

1 Like

Your code passes with \n instead of endl.
https://www.codechef.com/viewsolution/37012683
Also

You should not evaluate time complexity using if-else conditions.

1 Like