結果

問題 No.2941 Sigma Music Game Score Problem
ユーザー a1048576a1048576
提出日時 2024-10-18 22:35:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 595 ms / 2,500 ms
コード長 431 bytes
コンパイル時間 3,880 ms
コンパイル使用メモリ 229,752 KB
実行使用メモリ 11,116 KB
最終ジャッジ日時 2024-10-18 22:52:45
合計ジャッジ時間 10,723 ms
ジャッジサーバーID
(参考情報)
judge5 / judge7
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,812 KB
testcase_02 AC 2 ms
6,812 KB
testcase_03 AC 1 ms
6,816 KB
testcase_04 AC 1 ms
6,944 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 2 ms
6,940 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 4 ms
6,944 KB
testcase_10 AC 3 ms
6,944 KB
testcase_11 AC 3 ms
6,944 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 5 ms
6,944 KB
testcase_14 AC 6 ms
6,944 KB
testcase_15 AC 4 ms
6,944 KB
testcase_16 AC 413 ms
8,812 KB
testcase_17 AC 466 ms
9,516 KB
testcase_18 AC 525 ms
10,868 KB
testcase_19 AC 427 ms
8,948 KB
testcase_20 AC 349 ms
8,120 KB
testcase_21 AC 151 ms
6,944 KB
testcase_22 AC 161 ms
6,940 KB
testcase_23 AC 153 ms
6,944 KB
testcase_24 AC 535 ms
10,856 KB
testcase_25 AC 62 ms
6,944 KB
testcase_26 AC 2 ms
6,940 KB
testcase_27 AC 2 ms
6,940 KB
testcase_28 AC 1 ms
6,944 KB
testcase_29 AC 126 ms
6,944 KB
testcase_30 AC 193 ms
8,240 KB
testcase_31 AC 585 ms
11,116 KB
testcase_32 AC 595 ms
11,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all> 
using mint = atcoder::modint998244353;
#define int long long
signed main() {
  int n,m;
  cin >> n >> m;
  vector<int> a(m+2);
  a[0] = 0;
  for(int i = 1; i <= m; i++) cin >> a[i];
  a[m+1] = n+1;
  mint ans = 0, mod = 998244353;
  for(int i = 0; i < m+1; i++) {
    mint s = a[i+1]-a[i]-1;
    ans+=s*(s+1)*(s*2+1);
  }
  ans/=6;
  cout << ans.val() << endl;
}
0