Time Complexity Issue

Revision en1, by education420, 2019-12-27 21:40:06

I have a query related to the time complexity of the code.

Question: https://mirror.codeforces.com/problemset/problem/1265/B

My First Solution which was giving me timeout at 6th testcase: https://mirror.codeforces.com/contest/1265/submission/67753420

My Second Solution which got accepted: https://mirror.codeforces.com/contest/1265/submission/67753486

(Actually this is editorial code, I have copy pasted it).

Can please some one let me know why my first solution is giving me TLE and the second solution is getting accepted.

Merry Christmas.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English education420 2019-12-27 21:40:06 575 Initial revision (published)