結果

問題 No.2055 12x34...
ユーザー simansiman
提出日時 2022-08-23 03:10:48
言語 Ruby
(3.3.0)
結果
TLE  
実行時間 -
コード長 313 bytes
コンパイル時間 304 ms
コンパイル使用メモリ 7,552 KB
実行使用メモリ 93,752 KB
最終ジャッジ日時 2024-04-18 15:55:45
合計ジャッジ時間 11,754 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 80 ms
19,488 KB
testcase_01 AC 81 ms
12,160 KB
testcase_02 AC 210 ms
15,232 KB
testcase_03 AC 380 ms
21,760 KB
testcase_04 AC 515 ms
25,600 KB
testcase_05 AC 565 ms
26,880 KB
testcase_06 AC 521 ms
25,472 KB
testcase_07 AC 416 ms
21,888 KB
testcase_08 AC 330 ms
20,096 KB
testcase_09 AC 651 ms
28,160 KB
testcase_10 AC 691 ms
29,696 KB
testcase_11 AC 308 ms
18,176 KB
testcase_12 AC 328 ms
57,212 KB
testcase_13 AC 544 ms
90,520 KB
testcase_14 AC 269 ms
46,156 KB
testcase_15 AC 272 ms
46,064 KB
testcase_16 AC 571 ms
93,752 KB
testcase_17 TLE -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
Syntax OK

ソースコード

diff #

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

counter = Hash.new { |h, k| h[k] = Hash.new(0) }
ans = 0

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

  counter[a - 1].each do |len, cnt|
    counter[a][len + 1] += cnt
  end
  counter[a][1] += 1
end

puts ans
0