I'm getting TLE on 1542B with O(logn) (i think)

Revision en1, by pedrovictor48, 2021-07-04 02:13:45

Firstly i came up with this solution: https://codeforces.me/contest/1542/submission/121218884 I think it's O(n) in worst cases, and i got TLE. But shouldn't O(n) be sufficient for these constraints?

After the contest I also updated a O(logn) solution, and its similar to others that i saw submitted, but its getting TLE too: https://codeforces.me/contest/1542/submission/121269280

What am I missing here?

Tags #help me, #beginner, #time complexity

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English pedrovictor48 2021-07-04 02:13:45 580 Initial revision (published)