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ā€. https://codeforces.com/blog/entry/43780#:~:text=Endl%20is%20actually%20slower%20because,\n%20ā€™%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