結果

問題 No.243 出席番号(2)
ユーザー cielciel
提出日時 2015-07-12 03:21:07
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 210 bytes
コンパイル時間 538 ms
コンパイル使用メモリ 11,268 KB
実行使用メモリ 19,724 KB
最終ジャッジ日時 2023-09-22 14:16:46
合計ジャッジ時間 25,858 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
15,164 KB
testcase_01 AC 77 ms
15,148 KB
testcase_02 AC 77 ms
15,040 KB
testcase_03 AC 206 ms
15,104 KB
testcase_04 AC 213 ms
15,108 KB
testcase_05 AC 207 ms
15,176 KB
testcase_06 AC 207 ms
15,136 KB
testcase_07 AC 207 ms
15,052 KB
testcase_08 AC 595 ms
15,308 KB
testcase_09 AC 590 ms
15,180 KB
testcase_10 AC 591 ms
15,208 KB
testcase_11 AC 591 ms
15,212 KB
testcase_12 AC 588 ms
15,104 KB
testcase_13 AC 1,231 ms
15,544 KB
testcase_14 AC 1,227 ms
15,620 KB
testcase_15 AC 1,226 ms
15,428 KB
testcase_16 AC 1,226 ms
15,348 KB
testcase_17 AC 1,227 ms
15,296 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
testcase_21 TLE -
testcase_22 TLE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

M=10**9+7
c=[0]*5000
N=gets.to_i
$<.map{|e|c[e.to_i]+=1}
a=[1]+[0]*N
p=[1]+[0]*N
N.times{|i|
p[i+1]=p[i]*(i+1)%M
N.downto(1){|j|a[j]=(a[j]+a[j-1]*c[i])%M}
}
r=0
0.upto(N){|i|r=(r+(-1)**(i%2)*a[i]*p[N-i])%M}
p r
0