結果
| 問題 |
No.2941 Sigma Music Game Score Problem
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-10-18 23:04:06 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 802 ms / 2,500 ms |
| コード長 | 458 bytes |
| コンパイル時間 | 4,163 ms |
| コンパイル使用メモリ | 254,100 KB |
| 最終ジャッジ日時 | 2025-02-24 21:12:25 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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;
}