It shows time limit exceeded idk Y

Run your solution with the following test input:

How long does it take to finish?

1 Like

idk probably less than 1 sec.

I ask you to try it, not to guess :stuck_out_tongue:

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)

1 Like

Yes that could possibly the cause of tle, thank you.
it shows wa now , and idk why