結果
| 問題 | 
                            No.2941 Sigma Music Game Score Problem
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2024-10-18 21:41:36 | 
| 言語 | C++14  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                MLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 431 bytes | 
| コンパイル時間 | 3,817 ms | 
| コンパイル使用メモリ | 230,104 KB | 
| 実行使用メモリ | 814,004 KB | 
| 最終ジャッジ日時 | 2024-10-18 22:34:02 | 
| 合計ジャッジ時間 | 6,116 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 5 MLE * 1 -- * 23 | 
ソースコード
#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all> 
using mint = atcoder::modint998244353;
#define int long long
signed main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(n+2);
  a[0] = 0;
  for(int i = 1; i <= m; i++) cin >> a[i];
  a[m+1] = n+1;
  mint ans = 0, mod = 998244353;
  for(int i = 0; i < m+1; i++) {
    mint s = a[i+1]-a[i]-1;
    ans+=s*(s+1)*(s*2+1);
  }
  ans/=6;
  cout << ans.val() << endl;
}