結果

問題 No.2941 Sigma Music Game Score Problem
ユーザー amesyu
提出日時 2024-10-24 11:30:51
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 512 ms / 2,500 ms
コード長 241 bytes
コンパイル時間 919 ms
コンパイル使用メモリ 82,428 KB
実行使用メモリ 260,992 KB
最終ジャッジ日時 2024-10-24 11:31:02
合計ジャッジ時間 10,459 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #

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

x = list(map(int, input().split())) + [m+1]

def add(l, r):
    x = r - l
    return x*(x+1)*(2*x+1)//6

miss = 0
ans = 0

for v in x:
    ans += add(miss+1, v)
    ans %= 998244353
    miss = v

print(ans)
0