結果

問題 No.2055 12x34...
ユーザー norioc
提出日時 2025-06-04 04:31:10
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 241 bytes
コンパイル時間 489 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 156,272 KB
最終ジャッジ日時 2025-06-04 04:31:18
合計ジャッジ時間 7,914 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

MOD = 998244353
N = int(input())
A = list(map(int, input().split()))

dp = defaultdict(int)
ans = 0
for a in A:
    dp[a] = max(dp[a], dp[a-1] + 1)
    ans += max(0, dp[a] - 1)
    ans %= MOD

print(ans)
0