結果
問題 |
No.2941 Sigma Music Game Score Problem
|
ユーザー |
|
提出日時 | 2024-10-18 23:15:18 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,000 bytes |
コンパイル時間 | 3,326 ms |
コンパイル使用メモリ | 198,772 KB |
最終ジャッジ日時 | 2025-02-24 21:15:59 |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 14 WA * 15 |
ソースコード
#include <bits/stdc++.h> #define rep(i, a, n) for (int i = a; i < (int)(n); i++) #define all(a) begin(a), end(a) #define rall(a) rbegin(a), rend(a) #define vi vector<int> #define vs vector<string> #define vvi vector<vector<int>> #define vb vector<bool> #define ll long long #define dd double using namespace std; void faster() { ios::sync_with_stdio(false); cin.tie(0); } template <typename T> void input(T &x) { cin >> x; } template <typename T, typename... Args> void input(T &x, Args &...args) { cin >> x; input(args...); } template <typename T> void sorts(vector<T> &vec) { sort(vec.begin(), vec.end()); } template <typename T> void rsorts(vector<T> &vec) { sort(vec.begin(), vec.end(), greater<T>()); } template <class T> inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } struct timekeeper { chrono::high_resolution_clock::time_point starttime; chrono::high_resolution_clock::time_point endtime; chrono::duration<double> duration; }; unsigned ll sum_1_to_n(const unsigned ll &a) { return a * (a + 1) / 2; } ll rounding(ll target, ll keta) { ll now = 1; rep(i, 0, keta) { target /= now; int k = target % 10; if (k >= 5) { target += 10 - k; } else { target -= k; } target *= now; now *= 10; } return target; } string RLE(const string &s) { int cnt = 0; char ch = s[0]; string res; for (char now : s) { if (now == ch) { cnt++; } else { if (cnt > 1) { res += to_string(cnt) + ch; } else { res += ch; } ch = now; cnt = 1; } } if (cnt > 1) { res += to_string(cnt) + ch; } else { res += ch; } return res; } unsigned ll power(const unsigned ll &n) { unsigned ll a = n * (n + 1) / 2; unsigned ll b = 2 * n + 1; return a * b / 3; } // 上、下、右、左、右上、右下、左上、左下 vi xmove = {0, 0, 1, -1, 1, 1, -1, -1}; vi ymove = {-1, 1, 0, 0, -1, 1, -1, 1}; const unsigned long long MOD = 998244353; int main() { unsigned long long m, n; cin >> m >> n; vector<unsigned long long> vl(n); for (unsigned long long i = 0; i < n; ++i) { cin >> vl[i]; } if (n == 0) { cout << power(m) << endl; return 0; } unsigned ll ans = 0; ans += power(vl[0] - 1) % 998244353; unsigned ll note = vl[0] + 1; rep(i, 1, n) { ans += power(vl[i] - note) % 998244353; note = vl[i] + 1; } ans += power(m - note + 1) % 998244353; cout << ans % 998244353 << endl; }