結果

問題 No.1035 Color Box
ユーザー titiatitia
提出日時 2020-12-31 15:00:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 410 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 296 ms
コンパイル使用メモリ 11,004 KB
実行使用メモリ 24,092 KB
最終ジャッジ日時 2023-07-30 19:34:34
合計ジャッジ時間 10,854 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 397 ms
23,932 KB
testcase_01 AC 148 ms
24,092 KB
testcase_02 AC 129 ms
24,016 KB
testcase_03 AC 149 ms
23,884 KB
testcase_04 AC 326 ms
23,956 KB
testcase_05 AC 168 ms
23,940 KB
testcase_06 AC 127 ms
23,896 KB
testcase_07 AC 371 ms
23,968 KB
testcase_08 AC 396 ms
23,880 KB
testcase_09 AC 375 ms
23,936 KB
testcase_10 AC 214 ms
24,052 KB
testcase_11 AC 136 ms
23,880 KB
testcase_12 AC 147 ms
24,016 KB
testcase_13 AC 407 ms
23,896 KB
testcase_14 AC 410 ms
23,920 KB
testcase_15 AC 399 ms
24,012 KB
testcase_16 AC 129 ms
23,940 KB
testcase_17 AC 127 ms
23,940 KB
testcase_18 AC 129 ms
23,880 KB
testcase_19 AC 397 ms
23,944 KB
testcase_20 AC 129 ms
24,076 KB
testcase_21 AC 130 ms
23,944 KB
testcase_22 AC 128 ms
23,868 KB
testcase_23 AC 129 ms
24,020 KB
testcase_24 AC 127 ms
23,940 KB
testcase_25 AC 125 ms
23,924 KB
testcase_26 AC 126 ms
24,072 KB
testcase_27 AC 125 ms
24,044 KB
testcase_28 AC 128 ms
23,920 KB
testcase_29 AC 128 ms
24,060 KB
testcase_30 AC 127 ms
23,900 KB
testcase_31 AC 128 ms
23,936 KB
testcase_32 AC 129 ms
23,816 KB
testcase_33 AC 130 ms
23,940 KB
testcase_34 AC 129 ms
23,900 KB
testcase_35 AC 127 ms
23,968 KB
testcase_36 AC 127 ms
23,940 KB
testcase_37 AC 127 ms
23,932 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
mod=10**9+7

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

FACT_INV=[pow(FACT[-1],mod-2,mod)]
for i in range(2*10**5,0,-1):
    FACT_INV.append(FACT_INV[-1]*i%mod)

FACT_INV.reverse()

def Combi(a,b):
    if 0<=b<=a:
        return FACT[a]*FACT_INV[b]*FACT_INV[a-b]%mod
    else:
        return 0

ANS=0
for i in range(N):
    ANS+=(-1)**i*Combi(M,i)*pow(M-i,N,mod)
    ANS%=mod
print(ANS)
0