結果

問題 No.243 出席番号(2)
ユーザー convexineqconvexineq
提出日時 2020-12-30 22:00:33
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 408 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 67,584 KB
最終ジャッジ日時 2024-04-16 22:31:18
合計ジャッジ時間 3,920 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
57,952 KB
testcase_01 AC 45 ms
58,368 KB
testcase_02 AC 45 ms
57,984 KB
testcase_03 AC 53 ms
60,800 KB
testcase_04 AC 52 ms
61,568 KB
testcase_05 AC 53 ms
60,672 KB
testcase_06 AC 54 ms
60,672 KB
testcase_07 MLE -
testcase_08 AC 67 ms
63,104 KB
testcase_09 AC 69 ms
62,592 KB
testcase_10 AC 66 ms
62,540 KB
testcase_11 AC 67 ms
62,720 KB
testcase_12 MLE -
testcase_13 AC 83 ms
63,104 KB
testcase_14 AC 83 ms
63,104 KB
testcase_15 AC 82 ms
62,976 KB
testcase_16 AC 81 ms
62,848 KB
testcase_17 MLE -
testcase_18 AC 104 ms
63,488 KB
testcase_19 AC 105 ms
63,872 KB
testcase_20 AC 105 ms
63,232 KB
testcase_21 AC 105 ms
63,616 KB
testcase_22 MLE -
testcase_23 MLE -
testcase_24 AC 132 ms
63,616 KB
testcase_25 AC 132 ms
63,872 KB
testcase_26 MLE -
testcase_27 AC 132 ms
63,744 KB
testcase_28 AC 45 ms
57,728 KB
testcase_29 AC 45 ms
57,984 KB
testcase_30 AC 45 ms
57,984 KB
testcase_31 AC 45 ms
58,240 KB
testcase_32 AC 45 ms
57,984 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9+7
SIZE = 6000
fac = [0]*SIZE
fac[0] = fac[1] = 1
for i in range(2,SIZE):
    fac[i] = fac[i-1]*i%MOD

n,*a = map(int,open(0).read().split())
r = [0]*n
for i in a: r[i] += 1
dp = [1]
for ri in r:
    dp += [0]
    for i in range(len(dp)-1,0,-1):
        dp[i] += ri*dp[i-1]
        dp[i] %= MOD
ans = 0
sgn = 1
for i,xi in enumerate(dp):
    ans += sgn*xi*fac[n-i]%MOD
    sgn *= -1
print(ans%MOD)
0