結果

問題 No.2055 12x34...
ユーザー simansiman
提出日時 2022-08-23 03:16:09
言語 Ruby
(3.3.0)
結果
AC  
実行時間 287 ms / 2,000 ms
コード長 212 bytes
コンパイル時間 534 ms
コンパイル使用メモリ 7,424 KB
実行使用メモリ 35,328 KB
最終ジャッジ日時 2024-04-18 16:02:23
合計ジャッジ時間 11,406 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 89 ms
12,160 KB
testcase_01 AC 86 ms
12,288 KB
testcase_02 AC 124 ms
14,848 KB
testcase_03 AC 178 ms
19,200 KB
testcase_04 AC 204 ms
21,632 KB
testcase_05 AC 211 ms
22,272 KB
testcase_06 AC 203 ms
21,120 KB
testcase_07 AC 181 ms
19,456 KB
testcase_08 AC 154 ms
17,664 KB
testcase_09 AC 233 ms
23,168 KB
testcase_10 AC 242 ms
25,472 KB
testcase_11 AC 149 ms
17,280 KB
testcase_12 AC 189 ms
25,088 KB
testcase_13 AC 246 ms
33,024 KB
testcase_14 AC 156 ms
22,400 KB
testcase_15 AC 156 ms
22,144 KB
testcase_16 AC 263 ms
33,664 KB
testcase_17 AC 164 ms
19,200 KB
testcase_18 AC 219 ms
25,984 KB
testcase_19 AC 117 ms
14,848 KB
testcase_20 AC 101 ms
13,056 KB
testcase_21 AC 118 ms
14,720 KB
testcase_22 AC 273 ms
31,488 KB
testcase_23 AC 271 ms
32,256 KB
testcase_24 AC 271 ms
35,200 KB
testcase_25 AC 276 ms
35,200 KB
testcase_26 AC 279 ms
35,328 KB
testcase_27 AC 268 ms
35,200 KB
testcase_28 AC 272 ms
35,200 KB
testcase_29 AC 275 ms
35,328 KB
testcase_30 AC 287 ms
35,072 KB
testcase_31 AC 270 ms
35,072 KB
testcase_32 AC 272 ms
35,200 KB
testcase_33 AC 249 ms
25,216 KB
testcase_34 AC 246 ms
24,960 KB
testcase_35 AC 248 ms
25,216 KB
testcase_36 AC 246 ms
24,960 KB
testcase_37 AC 257 ms
25,216 KB
testcase_38 AC 244 ms
25,216 KB
testcase_39 AC 252 ms
25,088 KB
testcase_40 AC 250 ms
24,960 KB
testcase_41 AC 249 ms
24,960 KB
testcase_42 AC 249 ms
25,088 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

N = gets.to_i
A = gets.split.map(&:to_i)
MOD = 998_244_353

counter = Hash.new(0)
ans = 0

A.each do |a|
  ans += counter[a - 1]
  ans %= MOD

  counter[a] += counter[a - 1] + 1
  counter[a] %= MOD
end

puts ans
0