結果

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

ソースコード

diff #

M,N = map(int,input().split())
X = [0]+list(map(int,input().split()))+[M+1]
MOD = 998244353
ans = 0
for i in range(1,N+2):
    x0 = X[i-1]
    x1 = X[i]
    n = x1-x0-1
    ans = (ans+(n*(n+1)*(2*n+1))//6)%MOD
print(ans)
0