結果

問題 No.1035 Color Box
ユーザー c-yanc-yan
提出日時 2020-06-21 01:30:28
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 538 bytes
コンパイル時間 147 ms
コンパイル使用メモリ 10,948 KB
実行使用メモリ 43,540 KB
最終ジャッジ日時 2023-09-16 17:58:12
合計ジャッジ時間 8,644 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 AC 18 ms
8,280 KB
testcase_02 AC 16 ms
7,816 KB
testcase_03 AC 83 ms
9,876 KB
testcase_04 AC 89 ms
10,004 KB
testcase_05 AC 41 ms
8,828 KB
testcase_06 AC 22 ms
8,348 KB
testcase_07 AC 24 ms
8,324 KB
testcase_08 AC 790 ms
28,108 KB
testcase_09 AC 329 ms
16,252 KB
testcase_10 AC 16 ms
7,824 KB
testcase_11 AC 16 ms
7,928 KB
testcase_12 AC 16 ms
7,884 KB
testcase_13 AC 627 ms
23,684 KB
testcase_14 AC 713 ms
25,660 KB
testcase_15 AC 903 ms
30,944 KB
testcase_16 AC 15 ms
7,768 KB
testcase_17 AC 16 ms
7,856 KB
testcase_18 AC 16 ms
7,812 KB
testcase_19 RE -
testcase_20 AC 16 ms
7,772 KB
testcase_21 AC 15 ms
7,812 KB
testcase_22 AC 15 ms
7,932 KB
testcase_23 AC 16 ms
7,972 KB
testcase_24 AC 16 ms
7,892 KB
testcase_25 AC 16 ms
7,852 KB
testcase_26 AC 16 ms
7,816 KB
testcase_27 AC 16 ms
7,804 KB
testcase_28 AC 16 ms
7,972 KB
testcase_29 AC 15 ms
7,812 KB
testcase_30 AC 15 ms
7,768 KB
testcase_31 AC 16 ms
7,776 KB
testcase_32 AC 15 ms
7,960 KB
testcase_33 AC 16 ms
7,848 KB
testcase_34 AC 15 ms
7,840 KB
testcase_35 AC 15 ms
7,964 KB
testcase_36 AC 16 ms
7,880 KB
testcase_37 AC 16 ms
7,964 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from sys import setrecursionlimit

setrecursionlimit(10 ** 5)

N, M = map(int, input().split())

fac = [0] * (M + 1)
fac[0] = 1
for i in range(M):
    fac[i + 1] = fac[i] * (i + 1) % 1000000007


def mcomb(n, k):
    if n == 0 and k == 0:
        return 1
    if n < k or k < 0:
        return 0
    return fac[n] * pow(fac[n - k], 1000000005, 1000000007) * pow(fac[k], 1000000005, 1000000007) % 1000000007


def f(i):
    if i == 0:
        return 0
    return (mcomb(M, i) * pow(i, N, 1000000007) - f(i - 1)) % 1000000007


print(f(M))
0