結果

問題 No.2941 Sigma Music Game Score Problem
ユーザー tkykwtnb
提出日時 2024-10-18 22:27:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 409 ms / 2,500 ms
コード長 196 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 82,300 KB
実行使用メモリ 261,844 KB
最終ジャッジ日時 2024-10-18 22:51:17
合計ジャッジ時間 6,777 ms
ジャッジサーバーID
(参考情報)
judge7 / judge
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

M,N=map(int,input().split())
X=list(map(int,input().split()))
ans=0
pre=0
for now in X:
    n=now-1-pre
    ans+=n*(n+1)*(2*n+1)//6
    pre=now
n=M-pre
ans+=n*(n+1)*(2*n+1)//6
print(ans%998244353)
0