dario-dsa's blog

By dario-dsa, 10 years ago, In English

HI, I am having problem with figure it a fast way to solve this problem so can anyone help me?
http://codeforces.com/contest/243/problem/A

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

»
10 years ago, # |
Rev. 2   Vote: I like it +6 Vote: I do not like it

For each R, there are at most log(106) distinct values of F(L, R). For k-th bit, we find max(i | i <= R and (bit k in a[i] = 1)). These will be all possible values of L.