結果
問題 |
No.2941 Sigma Music Game Score Problem
|
ユーザー |
|
提出日時 | 2024-10-19 19:23:01 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 156 ms / 2,500 ms |
コード長 | 466 bytes |
コンパイル時間 | 4,220 ms |
コンパイル使用メモリ | 252,256 KB |
最終ジャッジ日時 | 2025-02-24 21:39:38 |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); ll m, n; cin >> m >> n; vector<ll> x(n + 2); x[n + 1] = m + 1; for(int i = 1; i <= n; i++) cin >> x[i]; atcoder::modint998244353 ans, v; for(int i = 0; i <= n; i++){ v = x[i + 1] - x[i] - 1; ans += v * (v + 1) * (2 * v + 1); } cout << (ans / 6).val() << '\n'; }