catlak_profesor_mfb's blog

By catlak_profesor_mfb, 11 years ago, In English
»
11 years ago, hide # |
Rev. 2  
Vote: I like it +18 Vote: I do not like it

Now test to see how large the N has to be for it to be faster than segment trees ;p Though I have to admit, I didn't think it could be made so compact.

»
11 years ago, hide # |
 
Vote: I like it +35 Vote: I do not like it
ans=min(ans,lookup[sblock[t]&(~(((1<<(l-(r1*lg+lg)))-1)<<(r1*lg+(lg<<1)-l)))]+r1*lg+lg);

That looks really nice :)

»
11 years ago, hide # |
Rev. 4  
Vote: I like it 0 Vote: I do not like it

You split array into blocks of size , then build sparse table for each block and for all blocks. Am I right?

»
11 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

double post

»
11 years ago, hide # |
 
Vote: I like it -9 Vote: I do not like it

"block" is a sparse table for log(n) blocks of "data". Right? What do "sblock" and "lookup" exactly do?

»
11 years ago, hide # |
Rev. 2  
Vote: I like it 0 Vote: I do not like it

Nice One! But not efficient for large value of N.

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

Read the topic here e-maxx.ru/algo