結果
| 問題 | No.2941 Sigma Music Game Score Problem |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 23:04:06 |
| 言語 | C++17 (gcc 15.2.0 + boost 1.90.0) |
| 結果 |
AC
|
| 実行時間 | 500 ms / 2,500 ms |
| コード長 | 458 bytes |
| 記録 | |
| コンパイル時間 | 2,706 ms |
| コンパイル使用メモリ | 276,784 KB |
| 実行使用メモリ | 13,560 KB |
| 最終ジャッジ日時 | 2026-07-06 00:28:26 |
| 合計ジャッジ時間 | 9,340 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 29 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using ll = long long;
int main () {
ll M, N;
cin >> M >> N;
std::vector<ll> A = {0};
for (int i = 0; i < N; i ++) {
ll a;
cin >> a;
A.push_back(a);
}
A.push_back(M + 1);
mint ans = 0;
for (int i = 0; i <= N; i ++) {
mint d = A[i + 1] - A[i] - 1;
ans += d * (d + 1) * (2 * d + 1) / 6;
}
cout << ans.val() << endl;
}