isat1729's blog

By isat1729, history, 8 years ago, In English

Problem ID: 1097

Problem Name: Lucky Number

Problem Link: http://lightoj.com/volume_showproblem.php?problem=1097

My solution link: http://ideone.com/MF0yjB

How do I improve the complexity of my solution? Any help is really appreciated.

  • Vote: I like it
  • -5
  • Vote: I do not like it

»
8 years ago, # |
  Vote: I like it 0 Vote: I do not like it

As you are using binary search + bit, so to find the k'th number (in line 33) your complexity is log(N)*log(N). You can do this in just log(N) by using segment tree. Because you don't need any binary search then.