結果
| 問題 | 
                            No.2055 12x34...
                             | 
                    
| コンテスト | |
| ユーザー | 
                             taiga0629kyopro
                         | 
                    
| 提出日時 | 2022-08-24 09:08:10 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 192 ms / 2,000 ms | 
| コード長 | 220 bytes | 
| コンパイル時間 | 735 ms | 
| コンパイル使用メモリ | 81,920 KB | 
| 実行使用メモリ | 136,816 KB | 
| 最終ジャッジ日時 | 2024-10-11 19:14:18 | 
| 合計ジャッジ時間 | 7,724 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge1 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 41 | 
ソースコード
from _collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
ans=0
mod=998244353
dp=defaultdict(int)
for x in a:
    dp[x]+=1+dp[x-1]
    dp[x]%=mod
for x in dp:ans+=dp[x]
ans-=n
print(ans%mod)
            
            
            
        
            
taiga0629kyopro