結果
問題 | No.2941 Sigma Music Game Score Problem |
ユーザー |
|
提出日時 | 2024-10-18 23:04:06 |
言語 | C++17(gcc12) (gcc 12.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 716 ms / 2,500 ms |
コード長 | 458 bytes |
コンパイル時間 | 4,733 ms |
コンパイル使用メモリ | 264,496 KB |
実行使用メモリ | 13,484 KB |
最終ジャッジ日時 | 2024-10-18 23:04:30 |
合計ジャッジ時間 | 12,999 ms |
ジャッジサーバーID (参考情報) |
judge4 / 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; }