結果

問題 No.916 Encounter On A Tree
ユーザー rlangevinrlangevin
提出日時 2023-02-08 22:55:52
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 678 bytes
コンパイル時間 263 ms
コンパイル使用メモリ 87,140 KB
実行使用メモリ 75,792 KB
最終ジャッジ日時 2023-09-20 12:30:29
合計ジャッジ時間 8,476 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,140 KB
testcase_01 AC 73 ms
71,556 KB
testcase_02 AC 82 ms
75,640 KB
testcase_03 AC 80 ms
75,732 KB
testcase_04 AC 86 ms
75,652 KB
testcase_05 WA -
testcase_06 AC 81 ms
75,612 KB
testcase_07 AC 80 ms
75,340 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 70 ms
71,264 KB
testcase_11 AC 71 ms
71,260 KB
testcase_12 AC 79 ms
75,584 KB
testcase_13 AC 80 ms
75,536 KB
testcase_14 AC 81 ms
75,588 KB
testcase_15 AC 79 ms
75,544 KB
testcase_16 AC 76 ms
75,516 KB
testcase_17 WA -
testcase_18 AC 77 ms
70,996 KB
testcase_19 AC 80 ms
75,664 KB
testcase_20 AC 84 ms
75,616 KB
testcase_21 WA -
testcase_22 AC 84 ms
75,636 KB
testcase_23 WA -
testcase_24 AC 85 ms
75,468 KB
testcase_25 AC 85 ms
75,596 KB
testcase_26 AC 81 ms
75,792 KB
testcase_27 AC 84 ms
75,344 KB
testcase_28 AC 81 ms
75,344 KB
testcase_29 WA -
testcase_30 AC 86 ms
75,560 KB
testcase_31 AC 85 ms
75,348 KB
testcase_32 AC 84 ms
75,544 KB
testcase_33 AC 82 ms
75,680 KB
testcase_34 AC 80 ms
75,616 KB
testcase_35 AC 79 ms
75,344 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 81 ms
75,620 KB
testcase_40 WA -
testcase_41 AC 71 ms
71,492 KB
testcase_42 AC 71 ms
71,212 KB
testcase_43 AC 71 ms
71,400 KB
testcase_44 AC 73 ms
71,468 KB
testcase_45 AC 76 ms
75,732 KB
testcase_46 AC 71 ms
71,212 KB
testcase_47 AC 73 ms
71,368 KB
testcase_48 AC 72 ms
71,256 KB
testcase_49 AC 73 ms
71,200 KB
testcase_50 AC 72 ms
71,408 KB
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 73 ms
71,376 KB
testcase_54 AC 73 ms
71,280 KB
testcase_55 AC 71 ms
71,136 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

mod = 10 ** 9 + 7

def f(x):
    v = 1
    for i in range(1, 22):
        if 2 ** (i - 1) <= x <= 2 ** i - 1:
            v = i
    return v
            
def g(x):
    v = 1
    for i in range(1, x + 1):
        v *= i
        v %= mod
    return v

D, L, R, K = map(int, input().split())
ans = 1
for i in range(D):
    ans *= g(2 ** i)
    ans %= mod
    
dL, dR = f(L), f(R)
if dL >= dR:
    dL, dR = dR, dL
K -= dR - dL
# print("test", K, dR, dL, ans)
if K < 0 or K % 2:
    print(0)
    exit()
H = K // 2
if H >= dL:
    print(0)
    exit()
if H == 0:
    print(ans)
else:
    ans *= pow(2 ** (dL - 1) - 1, mod - 2, mod)
    ans *= 2 ** (H - 1)
    ans %= mod
    print(ans)
0