結果
問題 |
No.2941 Sigma Music Game Score Problem
|
ユーザー |
![]() |
提出日時 | 2024-10-19 13:27:02 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 296 ms / 2,500 ms |
コード長 | 509 bytes |
コンパイル時間 | 2,152 ms |
コンパイル使用メモリ | 196,756 KB |
最終ジャッジ日時 | 2025-02-24 21:31:36 |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; void fast_io() { ios_base::sync_with_stdio(false); cin.tie(nullptr); } #include <atcoder/modint> using mint = atcoder::modint998244353; int main() { fast_io(); long long m, n; cin >> m >> n; vector<long long> x(n + 2); x[0] = 0; for (int i = 1; i <= n; i++) { cin >> x[i]; } x[n + 1] = m + 1; mint ans = 0; for (int i = 1; i <= n + 1; i++) { mint d = x[i] - x[i - 1] - 1; ans += d * (d + 1) * (2 * d + 1) / 6; } cout << ans.val() << endl; }