結果

問題 No.2055 12x34...
ユーザー gemmarogemmaro
提出日時 2022-08-21 16:00:08
言語 Ruby
(3.3.0)
結果
AC  
実行時間 235 ms / 2,000 ms
コード長 233 bytes
コンパイル時間 224 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 35,328 KB
最終ジャッジ日時 2024-04-18 13:01:24
合計ジャッジ時間 9,215 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 76 ms
12,160 KB
testcase_01 AC 79 ms
12,160 KB
testcase_02 AC 102 ms
15,232 KB
testcase_03 AC 145 ms
19,456 KB
testcase_04 AC 159 ms
21,632 KB
testcase_05 AC 172 ms
22,400 KB
testcase_06 AC 176 ms
21,376 KB
testcase_07 AC 151 ms
19,456 KB
testcase_08 AC 126 ms
17,792 KB
testcase_09 AC 188 ms
23,424 KB
testcase_10 AC 182 ms
25,600 KB
testcase_11 AC 122 ms
17,280 KB
testcase_12 AC 158 ms
25,344 KB
testcase_13 AC 198 ms
33,280 KB
testcase_14 AC 134 ms
22,528 KB
testcase_15 AC 145 ms
22,144 KB
testcase_16 AC 203 ms
33,664 KB
testcase_17 AC 128 ms
19,072 KB
testcase_18 AC 175 ms
25,728 KB
testcase_19 AC 98 ms
14,720 KB
testcase_20 AC 83 ms
13,056 KB
testcase_21 AC 98 ms
14,848 KB
testcase_22 AC 208 ms
31,488 KB
testcase_23 AC 216 ms
32,256 KB
testcase_24 AC 214 ms
35,328 KB
testcase_25 AC 207 ms
35,328 KB
testcase_26 AC 206 ms
35,328 KB
testcase_27 AC 229 ms
35,328 KB
testcase_28 AC 225 ms
35,328 KB
testcase_29 AC 225 ms
35,328 KB
testcase_30 AC 221 ms
35,200 KB
testcase_31 AC 209 ms
35,328 KB
testcase_32 AC 235 ms
35,328 KB
testcase_33 AC 196 ms
25,216 KB
testcase_34 AC 205 ms
25,216 KB
testcase_35 AC 202 ms
25,216 KB
testcase_36 AC 188 ms
24,960 KB
testcase_37 AC 202 ms
25,088 KB
testcase_38 AC 192 ms
25,088 KB
testcase_39 AC 193 ms
25,216 KB
testcase_40 AC 198 ms
25,088 KB
testcase_41 AC 195 ms
25,216 KB
testcase_42 AC 194 ms
25,216 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map { _1.to_i }
M = 998244353
C = Hash.new(0)
A.each do |a|
  C[a] = (C[a] + (a.zero? ? 0 : C[a - 1]) + 1) % M
end
((C.values.sum - N) % M).tap { puts(_1) }
# ref: https://yukicoder.me/submissions/791136
0