Showing TLE in SQRSUBMA

I have commented here too

question link
answer link
editorial link

as in editorial Time complexity is given O( sqrt(X)+d(X)∗N) for each testcase and my code also have same complexity then why i am getting TLE is it because of O( sqrt(X)+2*d(X)∗N) (in mine) well i guess 2 does not affect that much or i am wrong somewhere plz correct me i am not been able to get what is wrong

Thanks

Using map adds an additional log factor to the complexity. Unfortunately with the constraints on this problem, that proves to be too much to pass.

1 Like

Oh ok Thanks