結果

問題 No.2055 12x34...
ユーザー ecotteaecottea
提出日時 2024-02-26 22:48:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 260 bytes
コンパイル時間 303 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 56,440 KB
最終ジャッジ日時 2024-09-29 11:47:04
合計ジャッジ時間 11,810 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 5 WA * 36
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n = int(input())
a = list(map(int, input().split()))

MOD = 998244353

res = 0

d = defaultdict(int)

for i in range(n):
    c = d[a[i] - 1]
    res += c
    nc = (d[a[i]] + c + 1) % MOD
    d[a[i]] += nc

print(res % MOD)
0