結果
問題 | No.2941 Sigma Music Game Score Problem |
ユーザー |
|
提出日時 | 2024-10-19 11:35:42 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 732 ms / 2,500 ms |
コード長 | 489 bytes |
コンパイル時間 | 6,270 ms |
コンパイル使用メモリ | 335,452 KB |
実行使用メモリ | 11,428 KB |
最終ジャッジ日時 | 2024-10-19 11:35:57 |
合計ジャッジ時間 | 14,500 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 29 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll=long long; using ld=long double; using ull=unsigned long long; using pii=pair<int,int>; using pll=pair<ll,ll>; using mint=modint998244353; const ll INF=1ll<<60; int main(){ ll M,N; cin>>M>>N; ll X[N+2]; X[0]=0; X[N+1]=M+1; for(int i=0;i<N;i++)cin>>X[i+1]; mint ans=0; for(int i=0;i<N+1;i++){ mint a=X[i+1]-X[i]; ans+=(a-1)*a*(2*a-1)/6; } cout<<ans.val()<<endl; }