結果

問題 No.2055 12x34...
ユーザー AEn
提出日時 2022-11-20 14:51:54
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 185 ms / 2,000 ms
コード長 247 bytes
コンパイル時間 152 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 156,008 KB
最終ジャッジ日時 2024-09-21 14:52:05
合計ジャッジ時間 7,506 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

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

d = defaultdict(int)
res = 0
for i in range(N):
    res += d[A[i]-1]
    res %= mod
    d[A[i]] += 1+d[A[i]-1]
    d[A[i]] %= mod
print(res)
0