結果

問題 No.243 出席番号(2)
ユーザー cielciel
提出日時 2018-02-10 03:46:13
言語 Crystal
(1.10.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 236 bytes
コンパイル時間 17,022 ms
コンパイル使用メモリ 254,736 KB
実行使用メモリ 4,824 KB
最終ジャッジ日時 2023-09-13 09:40:14
合計ジャッジ時間 19,953 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,412 KB
testcase_01 AC 2 ms
4,412 KB
testcase_02 AC 2 ms
4,432 KB
testcase_03 AC 9 ms
4,468 KB
testcase_04 AC 9 ms
4,468 KB
testcase_05 AC 9 ms
4,468 KB
testcase_06 AC 9 ms
4,552 KB
testcase_07 AC 9 ms
4,476 KB
testcase_08 AC 27 ms
4,580 KB
testcase_09 AC 27 ms
4,520 KB
testcase_10 AC 27 ms
4,560 KB
testcase_11 AC 26 ms
4,540 KB
testcase_12 AC 27 ms
4,612 KB
testcase_13 AC 57 ms
4,604 KB
testcase_14 AC 57 ms
4,536 KB
testcase_15 AC 57 ms
4,544 KB
testcase_16 AC 57 ms
4,592 KB
testcase_17 AC 57 ms
4,520 KB
testcase_18 AC 99 ms
4,656 KB
testcase_19 AC 99 ms
4,632 KB
testcase_20 AC 99 ms
4,656 KB
testcase_21 AC 100 ms
4,640 KB
testcase_22 AC 100 ms
4,644 KB
testcase_23 AC 154 ms
4,824 KB
testcase_24 AC 154 ms
4,740 KB
testcase_25 AC 153 ms
4,768 KB
testcase_26 AC 154 ms
4,732 KB
testcase_27 AC 154 ms
4,708 KB
testcase_28 AC 2 ms
4,428 KB
testcase_29 AC 2 ms
4,380 KB
testcase_30 AC 2 ms
4,432 KB
testcase_31 AC 2 ms
4,516 KB
testcase_32 AC 3 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

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+a[i]*(-1)**(i%2)*f[n-i])%M}
puts r
0