結果

問題 No.2055 12x34...
ユーザー SyuKing_Order
提出日時 2022-08-21 13:13:25
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 283 bytes
コンパイル時間 480 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 262,240 KB
最終ジャッジ日時 2024-10-10 06:02:54
合計ジャッジ時間 7,741 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 16 TLE * 1 -- * 24
権限があれば一括ダウンロードができます

ソースコード

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
    dist[i] %= 998244353
print(sum(dist)%998244353)
0