結果
問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
ユーザー | universato |
提出日時 | 2020-05-29 22:38:53 |
言語 | Ruby (3.3.0) |
結果 |
MLE
|
実行時間 | - |
コード長 | 404 bytes |
コンパイル時間 | 64 ms |
コンパイル使用メモリ | 7,552 KB |
実行使用メモリ | 296,064 KB |
最終ジャッジ日時 | 2024-04-23 23:57:57 |
合計ジャッジ時間 | 5,968 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | MLE | - |
testcase_01 | AC | 80 ms
12,160 KB |
testcase_02 | AC | 80 ms
12,288 KB |
testcase_03 | AC | 78 ms
12,288 KB |
testcase_04 | AC | 77 ms
12,416 KB |
testcase_05 | AC | 75 ms
12,288 KB |
testcase_06 | AC | 75 ms
12,160 KB |
testcase_07 | AC | 81 ms
12,160 KB |
testcase_08 | AC | 1,560 ms
113,920 KB |
testcase_09 | AC | 80 ms
12,160 KB |
testcase_10 | MLE | - |
testcase_11 | -- | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
コンパイルメッセージ
Main.rb:3: warning: assigned but unused variable - q Syntax OK
ソースコード
mod = 998244353 n, q = gets.to_s.split.map{|t| t.to_i } a = gets.to_s.split.map{|t| t.to_i } b = gets.to_s.split.map{|t| t.to_i } dp = Array.new(n+1){ [0] * (n+2) } dp[0][0] = 1 a.each_with_index do |t, i| i.downto(0) do |j| dp_cur = dp[i][j] dp_cur %= mod if dp_cur >= mod dp[i+1][j] += dp_cur * (t - 1) dp[i+1][j+1] += dp_cur end end b.map!{|t| dp[n][t] % mod } puts b