Need help in Atcoder Beginner Contest-138,Problem-F

Revision en1, by LovesProgramming, 2020-03-19 12:05:27

Link to the problem : https://atcoder.jp/contests/abc138/tasks/abc138_f

Problem Statement : Given are integers L and R . Find the number, modulo 10^9 + 7 , of pairs of integers ( x , y ) , ( L ≤ x ≤ y ≤ R ) such that the remainder when y is divided by x is equal to y XOR x .

1<=L<=R<=10^18

Basically, the crux of the problem is to find all the pairs (x,y) such that y>=x, MSB of "y" and "x" should be same , and wherever(position) the bits of "x" are set(1), at those positions, bits of "y" must also be set.

In the editorial,they solved this task using dp. (but gave close to no explanation what is done in the dp and its states)

Link(s) : 1)https://img.atcoder.jp/abc138/editorial.pdf

2)https://mirror.codeforces.com/blog/entry/69181?#comment-536085

But , nowhere is it mentioned what are the states of the dp ?

(dp[i][j][k][l] is used , but whats the meaning of "i" , "j" , "k" and "l" here ?)

Can somebody make the dp-states and transitions explanation simple and to the point ?

Tags #bitmask

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English LovesProgramming 2020-03-19 12:05:27 1091 Initial revision (published)