結果

問題 No.1035 Color Box
ユーザー titiatitia
提出日時 2020-12-31 15:00:32
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 443 bytes
コンパイル時間 93 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-04-17 20:38:46
合計ジャッジ時間 10,643 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 466 ms
26,496 KB
testcase_01 AC 187 ms
26,496 KB
testcase_02 AC 150 ms
26,368 KB
testcase_03 AC 176 ms
26,368 KB
testcase_04 AC 390 ms
26,496 KB
testcase_05 AC 204 ms
26,624 KB
testcase_06 AC 159 ms
26,496 KB
testcase_07 AC 435 ms
26,496 KB
testcase_08 AC 456 ms
26,368 KB
testcase_09 AC 447 ms
26,496 KB
testcase_10 AC 253 ms
26,368 KB
testcase_11 AC 165 ms
26,496 KB
testcase_12 AC 178 ms
26,496 KB
testcase_13 AC 463 ms
26,368 KB
testcase_14 AC 479 ms
26,496 KB
testcase_15 AC 457 ms
26,624 KB
testcase_16 AC 158 ms
26,496 KB
testcase_17 AC 160 ms
26,496 KB
testcase_18 AC 162 ms
26,496 KB
testcase_19 AC 468 ms
26,496 KB
testcase_20 AC 157 ms
26,496 KB
testcase_21 AC 157 ms
26,368 KB
testcase_22 AC 158 ms
26,496 KB
testcase_23 AC 156 ms
26,624 KB
testcase_24 AC 156 ms
26,624 KB
testcase_25 AC 162 ms
26,496 KB
testcase_26 AC 165 ms
26,496 KB
testcase_27 AC 157 ms
26,496 KB
testcase_28 AC 163 ms
26,368 KB
testcase_29 AC 161 ms
26,496 KB
testcase_30 AC 160 ms
26,624 KB
testcase_31 AC 157 ms
26,496 KB
testcase_32 AC 156 ms
26,496 KB
testcase_33 AC 162 ms
26,368 KB
testcase_34 AC 155 ms
26,496 KB
testcase_35 AC 161 ms
26,368 KB
testcase_36 AC 165 ms
26,496 KB
testcase_37 AC 155 ms
26,496 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