結果
問題 |
No.2055 12x34...
|
ユーザー |
![]() |
提出日時 | 2025-06-04 04:44:09 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 175 ms / 2,000 ms |
コード長 | 264 bytes |
コンパイル時間 | 654 ms |
コンパイル使用メモリ | 82,040 KB |
実行使用メモリ | 156,228 KB |
最終ジャッジ日時 | 2025-06-04 04:44:16 |
合計ジャッジ時間 | 6,897 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 |
ソースコード
from collections import defaultdict MOD = 998244353 N = int(input()) A = list(map(int, input().split())) dp = defaultdict(int) ans = 0 for a in A: x = dp[a-1] if x > 0: ans += x ans %= MOD dp[a] += x + 1 dp[a] %= MOD print(ans)