結果

問題 No.1066 #いろいろな色 / Red and Blue and more various colors (Easy)
ユーザー universatouniversato
提出日時 2020-05-29 22:56:55
言語 Crystal
(1.11.2)
結果
RE  
実行時間 -
コード長 364 bytes
コンパイル時間 17,840 ms
コンパイル使用メモリ 255,208 KB
実行使用メモリ 6,008 KB
最終ジャッジ日時 2023-09-13 10:39:24
合計ジャッジ時間 18,763 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
5,180 KB
testcase_01 AC 3 ms
5,212 KB
testcase_02 AC 3 ms
5,228 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 3 ms
5,048 KB
testcase_24 AC 3 ms
5,052 KB
testcase_25 RE -
testcase_26 AC 126 ms
5,908 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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(2*10**5+10){ 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")
0