https://www.codechef.com/problems/CSUB

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

Run your solution with the following test input:

http://vps2.etotheipiplusone.com:30176/public_html/codechef//CSUB-testcase-all-1s.txt

How long does it take to finish?

1 Like

idk probably less than 1 sec.

I ask you to try it, not to guess

1 Like

Yes sir ive tried 100000, it seems to take less than 1 sec , idk where to look time of exec on vscode.

i even tried the chrono function but it shows total input and output time

Your code has time complexity of t.n^2, where t is the no. of testcases. The input range for t is same as n, so the worst input will be when t = c1.10^5 and n = c2.10^5, effectively giving an n^3 complexity. This is what is probably leading to TLE. Hope this helps.

(c1, c2 are constants, and ‘.’ is for multiplication)