結果

問題 No.2941 Sigma Music Game Score Problem
ユーザー ルク
提出日時 2024-10-18 22:50:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 499 ms / 2,500 ms
コード長 307 bytes
コンパイル時間 316 ms
コンパイル使用メモリ 82,252 KB
実行使用メモリ 261,664 KB
最終ジャッジ日時 2024-10-18 22:55:41
合計ジャッジ時間 7,688 ms
ジャッジサーバーID
(参考情報)
judge8 / judge6
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

m,n=map(int,input().split())
a = list(map(int, input().split()))

score = 0
now = 1
smallMOD = 998244353
for i in range(n):
  k = a[i] - now
  score += k * (k + 1) * (2 * k + 1) // 6
  score %= smallMOD
  now = a[i] + 1
k = m + 1 - now
score += k * (k + 1) * (2 * k + 1) // 6
score %= smallMOD
print(score)
0