kinitic013's blog

By kinitic013, history, 21 month(s) ago, In English

I recently read this blog and tried to implement this data structure in problem 455D - Serega and Fun mentioned in comments but it's getting WA and I can't seem to find any bug in my data structure implementation , I know asking you all to debug my code is not good but it's a desperate move :<(

303760090 In my implementation i havn't stored size of each block as in the problem we are swapping so there's never going to be too many or too less blocks

Spoiler Code
  • Vote: I like it
  • -13
  • Vote: I do not like it

»
21 month(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

One of the issues came from your square root implementation, you are setting l=0,r=5000000001, which in the first iteration we get mid=(5000000001)/2=2500000000 square that and we get integer overflow, you should set r=1000000001 instead.