結果
問題 |
No.2941 Sigma Music Game Score Problem
|
ユーザー |
|
提出日時 | 2024-10-20 14:16:46 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 232 ms / 2,500 ms |
コード長 | 637 bytes |
コンパイル時間 | 1,822 ms |
コンパイル使用メモリ | 191,708 KB |
最終ジャッジ日時 | 2025-02-24 21:49:07 |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; using ll = long long; using ull = unsigned long long; constexpr int MOD = 998244353; #define rep(i, n) for (int i = 0; i < (int)(n); i++) #define rep2(i, l, r) for (int i = (l); i < (int)(r); i++) #define all(v) v.begin(), v.end() void ch(ll &a,ll b){ a=(a+b)%MOD; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); ll N,M; cin>>M>>N; auto sum3=[](ll a){ a%=MOD; return a*(a+1)%MOD*(a*2+1)%MOD*166374059%MOD; }; ll l=1,ans=0; rep(i,N){ ll r; cin>>r; ch(ans,sum3(r-l)); l=r+1; } ch(ans,sum3(M+1-l)); ch(ans,MOD); cout<<ans<<'\n'; }