Rocky_Danger's blog

By Rocky_Danger, history, 9 months ago, In English,

I don't know what is right place to ask help regarding questions. I am solving http://codeforces.com/contest/1100/problem/B I read tutorial which solves it in O(m), but my solution is also of O(m), and I am getting TLE. Can someone suggest me the improvements? This is my solution:http://codeforces.com/contest/1100/submission/48488959

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it

»
9 months ago, # |
  Vote: I like it +1 Vote: I do not like it

s=s+"0" This runs in O(n), not O(1). You should replace it with s+="0".

»
9 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Thanks man it worked.