結果

問題 No.243 出席番号(2)
ユーザー cielciel
提出日時 2018-02-10 03:09:18
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 284 bytes
コンパイル時間 195 ms
コンパイル使用メモリ 6,912 KB
実行使用メモリ 13,184 KB
最終ジャッジ日時 2024-04-17 23:38:21
合計ジャッジ時間 20,449 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
13,184 KB
testcase_01 AC 10 ms
6,400 KB
testcase_02 AC 9 ms
6,528 KB
testcase_03 AC 245 ms
6,400 KB
testcase_04 AC 237 ms
6,400 KB
testcase_05 AC 238 ms
6,400 KB
testcase_06 AC 243 ms
6,528 KB
testcase_07 AC 237 ms
6,528 KB
testcase_08 AC 938 ms
6,400 KB
testcase_09 AC 954 ms
6,656 KB
testcase_10 AC 958 ms
6,528 KB
testcase_11 AC 948 ms
6,528 KB
testcase_12 AC 944 ms
6,528 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
M=10**9+7
c=[0]*5000
N=int(sys.stdin.readline())
for i in range(N):c[int(sys.stdin.readline())]+=1
a=[1]+[0]*N
f=list(a)
for i in range(N):
	f[i+1]=f[i]*-~i%M
	for j in range(N,0,-1):a[j]=(a[j]+a[j-1]*c[i])%M
r=0
for i in range(N+1):r=(r+(-1)**(i%2)*a[i]*f[N-i])%M
print(r)
0