結果

問題 No.2055 12x34...
ユーザー ああ
提出日時 2022-12-28 16:16:48
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 269 ms / 2,000 ms
コード長 273 bytes
コンパイル時間 156 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 214,648 KB
最終ジャッジ日時 2024-11-23 17:19:47
合計ジャッジ時間 7,263 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict
N=int(input())
A=list(map(int,input().split()))
d=defaultdict(int)
cnt=defaultdict(int)
mod=998244353
for i in range(N):
    cnt[A[i]]+=1
    cnt[A[i]]%=mod
    d[A[i]]+=d[A[i]-1]+cnt[A[i]-1]
    d[A[i]]%=mod
print(sum(d.values())%mod)

0