結果

問題 No.916 Encounter On A Tree
ユーザー ttrttr
提出日時 2020-02-19 19:50:10
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 771 bytes
コンパイル時間 81 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 51,968 KB
最終ジャッジ日時 2024-04-17 04:58:33
合計ジャッジ時間 14,451 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,752 KB
testcase_01 AC 30 ms
10,752 KB
testcase_02 AC 411 ms
51,840 KB
testcase_03 AC 416 ms
51,840 KB
testcase_04 AC 392 ms
51,840 KB
testcase_05 AC 407 ms
51,840 KB
testcase_06 AC 410 ms
51,840 KB
testcase_07 AC 413 ms
51,840 KB
testcase_08 AC 77 ms
16,000 KB
testcase_09 AC 123 ms
20,992 KB
testcase_10 AC 30 ms
10,752 KB
testcase_11 AC 30 ms
10,752 KB
testcase_12 AC 399 ms
51,880 KB
testcase_13 AC 412 ms
51,840 KB
testcase_14 AC 404 ms
51,968 KB
testcase_15 AC 403 ms
51,800 KB
testcase_16 AC 126 ms
20,992 KB
testcase_17 AC 410 ms
51,836 KB
testcase_18 AC 32 ms
10,752 KB
testcase_19 AC 393 ms
51,968 KB
testcase_20 AC 400 ms
51,804 KB
testcase_21 AC 396 ms
51,840 KB
testcase_22 AC 392 ms
51,840 KB
testcase_23 WA -
testcase_24 AC 399 ms
51,884 KB
testcase_25 AC 393 ms
51,856 KB
testcase_26 AC 225 ms
31,420 KB
testcase_27 AC 215 ms
31,372 KB
testcase_28 AC 122 ms
20,992 KB
testcase_29 WA -
testcase_30 AC 393 ms
51,928 KB
testcase_31 AC 401 ms
51,840 KB
testcase_32 AC 406 ms
51,868 KB
testcase_33 AC 217 ms
31,384 KB
testcase_34 AC 125 ms
20,992 KB
testcase_35 AC 76 ms
15,872 KB
testcase_36 AC 394 ms
51,868 KB
testcase_37 AC 403 ms
51,880 KB
testcase_38 AC 126 ms
20,992 KB
testcase_39 AC 394 ms
51,840 KB
testcase_40 AC 402 ms
51,968 KB
testcase_41 AC 30 ms
10,752 KB
testcase_42 AC 29 ms
10,880 KB
testcase_43 AC 30 ms
10,880 KB
testcase_44 AC 29 ms
10,752 KB
testcase_45 AC 78 ms
16,000 KB
testcase_46 AC 30 ms
10,752 KB
testcase_47 AC 30 ms
10,752 KB
testcase_48 AC 29 ms
10,752 KB
testcase_49 AC 31 ms
10,880 KB
testcase_50 AC 30 ms
10,752 KB
testcase_51 AC 30 ms
10,880 KB
testcase_52 AC 30 ms
10,880 KB
testcase_53 AC 30 ms
10,752 KB
testcase_54 AC 30 ms
10,752 KB
testcase_55 AC 31 ms
10,752 KB
testcase_56 AC 30 ms
10,880 KB
testcase_57 WA -
testcase_58 AC 33 ms
11,264 KB
testcase_59 AC 38 ms
11,392 KB
testcase_60 AC 41 ms
12,032 KB
権限があれば一括ダウンロードができます

ソースコード

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**(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