結果

問題 No.2055 12x34...
ユーザー SyuKing_Order
提出日時 2022-08-21 13:14:33
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 132 ms / 2,000 ms
コード長 308 bytes
コンパイル時間 278 ms
コンパイル使用メモリ 82,364 KB
実行使用メモリ 112,632 KB
最終ジャッジ日時 2024-10-10 06:03:16
合計ジャッジ時間 5,882 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
a = list(map(int, input().split()))
g = {}
dist = [0]*n
for i in range(n):
    ai = a[i]
    if ai in g:
        dist[i] = g[ai]
    if ai+1 in g:
        g[ai+1] += dist[i]+1
    else:
        g[ai+1] = dist[i]+1
    g[ai+1] %= 998244353
    dist[i] %= 998244353
print(sum(dist)%998244353)
0