結果
| 問題 | 
                            No.2055 12x34...
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-10-04 23:32:28 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 216 ms / 2,000 ms | 
| コード長 | 229 bytes | 
| コンパイル時間 | 514 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 155,616 KB | 
| 最終ジャッジ日時 | 2024-12-30 14:15:49 | 
| 合計ジャッジ時間 | 8,545 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 41 | 
ソースコード
#yuki2055
from collections import defaultdict
mod = 998244353
N = int(input())
A = list(map(int, input().split()))
dp = defaultdict(int)
for a in A:
    dp[a] += dp[a-1] + 1
    dp[a] %= mod
print((sum(dp.values()) - N)%mod)