結果
| 問題 | 
                            No.2055 12x34...
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2022-08-23 06:43:40 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 165 ms / 2,000 ms | 
| コード長 | 250 bytes | 
| コンパイル時間 | 359 ms | 
| コンパイル使用メモリ | 82,496 KB | 
| 実行使用メモリ | 155,544 KB | 
| 最終ジャッジ日時 | 2024-10-10 13:29:31 | 
| 合計ジャッジ時間 | 7,297 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge1 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 41 | 
ソースコード
import sys
input = sys.stdin.readline
from collections import *
N = int(input())
A = list(map(int, input().split()))
d = defaultdict(int)
MOD = 998244353
for Ai in A:
    d[Ai] += 1+d[Ai-1]
    d[Ai] %= MOD
ans = (sum(d.values())-N)%MOD
print(ans)