結果

問題 No.2941 Sigma Music Game Score Problem
ユーザー rlangevin
提出日時 2024-10-20 12:15:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 505 ms / 2,500 ms
コード長 233 bytes
コンパイル時間 683 ms
コンパイル使用メモリ 82,220 KB
実行使用メモリ 262,012 KB
最終ジャッジ日時 2024-10-20 12:15:16
合計ジャッジ時間 8,549 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

M, N = map(int, input().split())
X = [0] + list(map(int, input().split())) + [M + 1]
ans = 0
mod = 998244353
for i in range(len(X) - 1):
    d = X[i + 1] - X[i] - 1
    ans += d * (d + 1) * (2 * d + 1) // 6
    ans %= mod

print(ans)
0