結果

問題 No.916 Encounter On A Tree
ユーザー tktk_snsntktk_snsn
提出日時 2020-12-30 15:32:54
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 558 bytes
コンパイル時間 411 ms
コンパイル使用メモリ 82,512 KB
実行使用メモリ 60,188 KB
最終ジャッジ日時 2024-04-16 17:08:03
合計ジャッジ時間 4,710 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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:
        print(lca)
        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