Submission #25649869


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)

#include <atcoder/modint>
using mint = atcoder::modint1000000007;

bitset<64> l, r;
// (i, l_x, y_r, y_2x): (x, y) の数え上げ
// l_x: l <= x か l < x か
// y_r: y <= r, y < r
// y_2x: y <= 2x, y < 2x
mint dp[65][2][2][2];

int main() {
  long long li, ri;
  scanf("%lld%lld", &li, &ri);
  l = li, r = ri;

  dp[0][1][1][1] = 1;

  rep(i, 64) rep(l_x, 2) rep(y_r, 2) {
    mint (&ans)[2] = dp[i + 1][l_x][y_r];
    int xlb = l[63 - i] - l_x, yub = r[63 - i] + y_r;

    ans[0] += dp[i][0 > xlb][0 < yub][0];
    ans[1] += dp[i][0 > xlb][0 < yub][1];

    ans[0] += dp[i][0 > xlb][1 < yub][0];
    ans[1] += dp[i][0 > xlb][1 < yub][0];

    ans[0] += dp[i][1 > xlb][1 < yub][1];
    ans[1] += dp[i][1 > xlb][1 < yub][1];
  }

  printf("%d\n", dp[64][1][1][0].val());
}

Submission Info

Submission Time
Task F - Coincidence
User shino16
Language C++ (GCC 9.2.1)
Score 600
Code Size 869 Byte
Status AC
Exec Time 10 ms
Memory 3800 KiB

Compile Error

./Main.cpp: In function ‘int main()’:
./Main.cpp:17:8: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result]
   17 |   scanf("%lld%lld", &li, &ri);
      |   ~~~~~^~~~~~~~~~~~~~~~~~~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 23
Set Name Test Cases
Sample a01, a02, a03
All a01, a02, a03, b04, b05, b06, b07, b08, b09, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23
Case Name Status Exec Time Memory
a01 AC 10 ms 3796 KiB
a02 AC 2 ms 3540 KiB
a03 AC 2 ms 3732 KiB
b04 AC 3 ms 3744 KiB
b05 AC 2 ms 3800 KiB
b06 AC 6 ms 3796 KiB
b07 AC 2 ms 3600 KiB
b08 AC 2 ms 3536 KiB
b09 AC 2 ms 3708 KiB
b10 AC 2 ms 3800 KiB
b11 AC 1 ms 3600 KiB
b12 AC 4 ms 3648 KiB
b13 AC 2 ms 3708 KiB
b14 AC 2 ms 3540 KiB
b15 AC 2 ms 3656 KiB
b16 AC 2 ms 3724 KiB
b17 AC 2 ms 3732 KiB
b18 AC 1 ms 3536 KiB
b19 AC 2 ms 3712 KiB
b20 AC 2 ms 3660 KiB
b21 AC 2 ms 3704 KiB
b22 AC 2 ms 3708 KiB
b23 AC 2 ms 3596 KiB