結果

問題 No.916 Encounter On A Tree
ユーザー ttrttr
提出日時 2020-02-19 19:47:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 777 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 51,840 KB
最終ジャッジ日時 2024-04-17 04:53:52
合計ジャッジ時間 14,546 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
10,496 KB
testcase_01 AC 32 ms
10,752 KB
testcase_02 AC 394 ms
51,712 KB
testcase_03 AC 395 ms
51,584 KB
testcase_04 AC 400 ms
51,584 KB
testcase_05 AC 433 ms
51,584 KB
testcase_06 AC 409 ms
51,584 KB
testcase_07 AC 401 ms
51,712 KB
testcase_08 AC 77 ms
15,616 KB
testcase_09 AC 122 ms
20,736 KB
testcase_10 AC 29 ms
10,624 KB
testcase_11 AC 29 ms
10,624 KB
testcase_12 AC 398 ms
51,712 KB
testcase_13 AC 390 ms
51,712 KB
testcase_14 AC 400 ms
51,584 KB
testcase_15 AC 400 ms
51,584 KB
testcase_16 AC 125 ms
20,736 KB
testcase_17 WA -
testcase_18 AC 31 ms
10,752 KB
testcase_19 AC 411 ms
51,712 KB
testcase_20 AC 396 ms
51,712 KB
testcase_21 WA -
testcase_22 AC 398 ms
51,712 KB
testcase_23 WA -
testcase_24 AC 391 ms
51,584 KB
testcase_25 AC 394 ms
51,712 KB
testcase_26 AC 215 ms
31,232 KB
testcase_27 AC 215 ms
31,232 KB
testcase_28 AC 125 ms
20,864 KB
testcase_29 WA -
testcase_30 AC 425 ms
51,584 KB
testcase_31 AC 400 ms
51,584 KB
testcase_32 AC 407 ms
51,712 KB
testcase_33 AC 217 ms
31,104 KB
testcase_34 AC 126 ms
20,864 KB
testcase_35 AC 76 ms
15,616 KB
testcase_36 AC 391 ms
51,712 KB
testcase_37 AC 401 ms
51,584 KB
testcase_38 WA -
testcase_39 AC 399 ms
51,712 KB
testcase_40 AC 407 ms
51,712 KB
testcase_41 AC 31 ms
10,752 KB
testcase_42 AC 31 ms
10,624 KB
testcase_43 AC 31 ms
10,752 KB
testcase_44 AC 31 ms
10,752 KB
testcase_45 AC 79 ms
15,744 KB
testcase_46 AC 31 ms
10,752 KB
testcase_47 AC 30 ms
10,624 KB
testcase_48 AC 31 ms
10,624 KB
testcase_49 AC 31 ms
10,752 KB
testcase_50 AC 31 ms
10,752 KB
testcase_51 AC 30 ms
10,752 KB
testcase_52 WA -
testcase_53 AC 30 ms
10,496 KB
testcase_54 AC 30 ms
10,624 KB
testcase_55 AC 32 ms
10,496 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 33 ms
11,008 KB
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

d,l,r,k = map(int, input().split())

mod = 10**9+7

P = [0]*(2**d+1)
P[0] = 1
for i in range(1, 2**d+1):
    P[i] = (P[i-1]*i)%mod

j = 1
while j <= d:
    if 2**(j-1) <= l < 2**j:
        jl = j
    if 2**(j-1) <= r < 2**j:
        jr = j
    j += 1

if (jr-jl)%2 == k%2 and jr-jl <= k <= jr-jl+2*(jl-1):
    t = k-(jr-jl)
    ans = 1
    for i in range(1, d+1):
        if i == jr and jl != jr:
            if t < 4:
                ans *= 2**(jr-jl)*P[2**(i-1)-1]
            else:
                ans *= 2**(jr-jl+t//2)*P[2**(i-1)-1]
            ans %= mod
            continue
        elif i == jr:
            ans *= 2**(i-1)*2**(t//2-1)*P[2**(i-1)-2]
            ans %= mod
            continue
        ans *= P[2**(i-1)]
        ans %= mod
else:
    ans = 0

print(ans)
0