結果

問題 No.916 Encounter On A Tree
ユーザー titiatitia
提出日時 2019-10-25 22:17:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 716 bytes
コンパイル時間 149 ms
コンパイル使用メモリ 10,924 KB
実行使用メモリ 49,524 KB
最終ジャッジ日時 2023-10-11 04:58:58
合計ジャッジ時間 11,879 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,796 KB
testcase_01 AC 16 ms
7,864 KB
testcase_02 AC 298 ms
49,480 KB
testcase_03 AC 294 ms
49,464 KB
testcase_04 AC 302 ms
49,288 KB
testcase_05 WA -
testcase_06 AC 295 ms
49,444 KB
testcase_07 AC 309 ms
49,388 KB
testcase_08 AC 52 ms
13,376 KB
testcase_09 AC 85 ms
18,424 KB
testcase_10 AC 16 ms
7,956 KB
testcase_11 AC 16 ms
7,956 KB
testcase_12 AC 301 ms
49,444 KB
testcase_13 AC 300 ms
49,480 KB
testcase_14 WA -
testcase_15 AC 304 ms
49,304 KB
testcase_16 AC 88 ms
18,396 KB
testcase_17 WA -
testcase_18 AC 16 ms
7,952 KB
testcase_19 AC 296 ms
49,364 KB
testcase_20 AC 301 ms
49,432 KB
testcase_21 WA -
testcase_22 AC 301 ms
49,440 KB
testcase_23 WA -
testcase_24 AC 297 ms
49,304 KB
testcase_25 AC 298 ms
49,476 KB
testcase_26 AC 162 ms
28,956 KB
testcase_27 AC 160 ms
28,820 KB
testcase_28 AC 87 ms
18,496 KB
testcase_29 WA -
testcase_30 AC 298 ms
49,288 KB
testcase_31 AC 297 ms
49,336 KB
testcase_32 AC 298 ms
49,496 KB
testcase_33 AC 163 ms
28,988 KB
testcase_34 AC 86 ms
18,360 KB
testcase_35 AC 51 ms
13,248 KB
testcase_36 AC 297 ms
49,432 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 293 ms
49,440 KB
testcase_40 AC 298 ms
49,500 KB
testcase_41 AC 16 ms
7,868 KB
testcase_42 AC 16 ms
7,880 KB
testcase_43 AC 16 ms
7,820 KB
testcase_44 AC 16 ms
7,952 KB
testcase_45 AC 51 ms
13,240 KB
testcase_46 AC 16 ms
7,956 KB
testcase_47 AC 15 ms
7,828 KB
testcase_48 AC 16 ms
7,924 KB
testcase_49 AC 16 ms
7,864 KB
testcase_50 AC 16 ms
7,820 KB
testcase_51 AC 16 ms
7,868 KB
testcase_52 WA -
testcase_53 AC 16 ms
8,008 KB
testcase_54 AC 16 ms
7,792 KB
testcase_55 AC 16 ms
8,012 KB
testcase_56 WA -
testcase_57 WA -
testcase_58 AC 18 ms
8,620 KB
testcase_59 WA -
testcase_60 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

TWO=[2**i for i in range(23)]

mod=10**9+7

FACT=[1]
for i in range(1,(1<<d)+1):
    FACT.append(FACT[-1]*i%mod)

for i in range(23):
    if l<TWO[i]:
        lh=i
        break

for i in range(23):
    if r<TWO[i]:
        rh=i
        break
    
if (lh+rh)%2==k%2 and abs(lh-rh)<=k<=lh+rh:
    ANS=1
    for i in range(d):
        ANS=ANS*FACT[1<<i]%mod

    #print(ANS)

    lh,rh=min(lh,rh),max(lh,rh)

    kei=(k-(rh-lh))//2

    #print(kei)

    if lh==rh:
        ANS=ANS*pow((1<<(lh-1))-1,mod-2,mod)*pow(2,kei-1,mod)%mod

        print(ANS)

    else:
        ANS=ANS*pow((1<<(lh-1)),mod-2,mod)*pow(2,kei,mod)%mod

        print(ANS)
        
    
    


else:
    print(0)
0