結果

問題 No.916 Encounter On A Tree
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-30 15:34:53
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 539 bytes
コンパイル時間 180 ms
コンパイル使用メモリ 82,816 KB
実行使用メモリ 58,240 KB
最終ジャッジ日時 2024-04-16 17:08:31
合計ジャッジ時間 4,664 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 47 ms
51,840 KB
testcase_02 AC 46 ms
51,584 KB
testcase_03 AC 54 ms
57,856 KB
testcase_04 AC 42 ms
52,096 KB
testcase_05 AC 55 ms
57,600 KB
testcase_06 WA -
testcase_07 AC 55 ms
57,984 KB
testcase_08 AC 48 ms
57,984 KB
testcase_09 AC 48 ms
57,984 KB
testcase_10 AC 43 ms
52,096 KB
testcase_11 AC 44 ms
52,480 KB
testcase_12 AC 42 ms
52,096 KB
testcase_13 AC 56 ms
57,856 KB
testcase_14 AC 42 ms
51,584 KB
testcase_15 AC 54 ms
57,856 KB
testcase_16 AC 42 ms
52,224 KB
testcase_17 AC 54 ms
57,856 KB
testcase_18 AC 42 ms
51,968 KB
testcase_19 AC 54 ms
57,600 KB
testcase_20 WA -
testcase_21 AC 54 ms
57,600 KB
testcase_22 AC 43 ms
51,840 KB
testcase_23 AC 54 ms
57,856 KB
testcase_24 AC 42 ms
51,584 KB
testcase_25 AC 55 ms
57,856 KB
testcase_26 AC 42 ms
52,224 KB
testcase_27 AC 51 ms
57,856 KB
testcase_28 AC 43 ms
51,584 KB
testcase_29 AC 53 ms
57,600 KB
testcase_30 AC 43 ms
51,968 KB
testcase_31 AC 41 ms
51,584 KB
testcase_32 AC 42 ms
51,840 KB
testcase_33 AC 42 ms
52,096 KB
testcase_34 AC 47 ms
58,240 KB
testcase_35 AC 47 ms
57,600 KB
testcase_36 AC 53 ms
57,856 KB
testcase_37 AC 53 ms
57,728 KB
testcase_38 AC 48 ms
57,728 KB
testcase_39 AC 41 ms
51,840 KB
testcase_40 AC 52 ms
57,856 KB
testcase_41 AC 42 ms
51,840 KB
testcase_42 AC 42 ms
52,096 KB
testcase_43 AC 42 ms
51,968 KB
testcase_44 AC 42 ms
51,840 KB
testcase_45 AC 48 ms
57,600 KB
testcase_46 AC 42 ms
51,712 KB
testcase_47 AC 42 ms
52,096 KB
testcase_48 AC 41 ms
52,224 KB
testcase_49 AC 42 ms
51,968 KB
testcase_50 AC 41 ms
51,968 KB
testcase_51 AC 42 ms
52,096 KB
testcase_52 AC 43 ms
51,584 KB
testcase_53 AC 42 ms
52,096 KB
testcase_54 AC 42 ms
51,840 KB
testcase_55 AC 44 ms
52,096 KB
testcase_56 AC 47 ms
57,984 KB
testcase_57 AC 47 ms
57,856 KB
testcase_58 AC 47 ms
57,728 KB
testcase_59 AC 47 ms
57,856 KB
testcase_60 AC 46 ms
57,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7
D, L, R, K = map(int, input().split())

dl = L.bit_length()
dr = R.bit_length()
for lca in range(1, D + 1):
    if dr + dl - 2 * lca == K:
        break
else:
    print(0)
    exit()


ans = pow(2, lca-1, mod)
if dl == lca:
    ans *= pow(2, dr - lca, mod)
    ans %= mod
else:
    ans *= pow(2, dl - lca, mod)
    ans *= pow(2, dr - lca - 1, mod)
    ans %= mod

cnt = [1 << i for i in range(D)]
cnt[dl - 1] -= 1
cnt[dr - 1] -= 1
for c in cnt:
    for i in range(2, c + 1):
        ans *= i
        ans %= mod
print(ans)
0