結果

問題 No.243 出席番号(2)
ユーザー cielciel
提出日時 2018-02-10 03:43:33
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 236 bytes
コンパイル時間 16,454 ms
コンパイル使用メモリ 255,804 KB
実行使用メモリ 5,028 KB
最終ジャッジ日時 2023-09-13 09:40:35
合計ジャッジ時間 19,417 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
4,412 KB
testcase_01 AC 2 ms
4,492 KB
testcase_02 AC 3 ms
4,432 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 RE -
testcase_22 RE -
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 AC 3 ms
4,416 KB
testcase_29 AC 2 ms
4,500 KB
testcase_30 AC 3 ms
4,428 KB
testcase_31 RE -
testcase_32 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

M=10**9+7
c=[0]*5000
r=0_i64
n=gets.not_nil!.to_i
n.times{c[gets.not_nil!.to_i]+=1}
a=[1_i64]+[0_i64]*n
f=a.dup
n.times{|i|f[i+1]=f[i]*-~i%M
n.downto(1){|j|a[j]=(a[j]+a[j-1]*c[i])%M}}
0.upto(n){|i|r=(r+(-1)**(i%2)*a[i]*f[n-i])%M}
puts r
0