結果

問題 No.243 出席番号(2)
ユーザー convexineqconvexineq
提出日時 2020-12-30 22:03:40
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
RE  
実行時間 -
コード長 408 bytes
コンパイル時間 85 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 17,024 KB
最終ジャッジ日時 2024-04-16 22:34:10
合計ジャッジ時間 24,054 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
16,384 KB
testcase_01 AC 32 ms
11,008 KB
testcase_02 AC 33 ms
11,136 KB
testcase_03 AC 194 ms
11,008 KB
testcase_04 AC 184 ms
11,008 KB
testcase_05 AC 182 ms
11,136 KB
testcase_06 AC 185 ms
11,008 KB
testcase_07 RE -
testcase_08 AC 710 ms
11,264 KB
testcase_09 AC 632 ms
11,136 KB
testcase_10 AC 643 ms
11,264 KB
testcase_11 AC 634 ms
11,136 KB
testcase_12 RE -
testcase_13 AC 1,521 ms
11,264 KB
testcase_14 AC 1,414 ms
11,264 KB
testcase_15 AC 1,409 ms
11,392 KB
testcase_16 AC 1,378 ms
11,264 KB
testcase_17 RE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 RE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

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