結果
| 問題 |
No.2941 Sigma Music Game Score Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 22:26:21 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 420 ms / 2,500 ms |
| コード長 | 365 bytes |
| コンパイル時間 | 402 ms |
| コンパイル使用メモリ | 82,832 KB |
| 実行使用メモリ | 200,808 KB |
| 最終ジャッジ日時 | 2024-10-18 22:50:57 |
| 合計ジャッジ時間 | 6,880 ms |
|
ジャッジサーバーID (参考情報) |
judge8 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
m,n=map(int,input().split())
x=map(int,input().split())
mod=998244353
ans=0
before=0
for xi in x:
if xi-before-1==0:
before=xi
continue
n=xi-before-1
# print(before, xi, n)
ans+=n*(n+1)*(2*n+1)//6
ans%=mod
before=xi
if m-before!=0:
n=m-before
# print(before, m, n)
ans+=n*(n+1)*(2*n+1)//6
ans%=mod
print(ans)