結果

問題 No.2055 12x34...
ユーザー rlangevin
提出日時 2022-08-21 17:06:56
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 193 ms / 2,000 ms
コード長 311 bytes
コンパイル時間 176 ms
コンパイル使用メモリ 81,900 KB
実行使用メモリ 155,344 KB
最終ジャッジ日時 2024-10-10 06:16:27
合計ジャッジ時間 6,204 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 41
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import *

def calc(A):
    D = defaultdict(int)
    mod = 998244353
    val = 0
    for i in range(N):
        v = D[A[i] - 1]
        D[A[i]] += v + 1
        D[A[i]] %= mod
        val += v
        val %= mod
    return val

N = int(input())
A = list(map(int, input().split()))
print(calc(A))
0