結果
問題 | No.1066 #いろいろな色 / Red and Blue and more various colors (Easy) |
ユーザー | universato |
提出日時 | 2020-05-29 22:46:07 |
言語 | Crystal (1.11.2) |
結果 |
RE
|
実行時間 | - |
コード長 | 357 bytes |
コンパイル時間 | 16,313 ms |
コンパイル使用メモリ | 254,148 KB |
実行使用メモリ | 5,288 KB |
最終ジャッジ日時 | 2023-09-13 10:40:07 |
合計ジャッジ時間 | 17,837 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,380 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,408 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 | AC | 2 ms
4,488 KB |
testcase_24 | AC | 3 ms
4,420 KB |
testcase_25 | RE | - |
testcase_26 | AC | 145 ms
5,136 KB |
ソースコード
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+2){ 0 } dp[0] = 1 a.each_with_index do |t, i| i.downto(0) do |j| dp[j+1] = ( dp[j+1] +dp[j] ) % mod dp[j] = ( dp[j] * (t - 1) ) % mod end end b.map!{|t| dp[t] % mod } puts b.join("\n")