結果

問題 No.2625 Bouns Ai
ユーザー norikamenorikame
提出日時 2024-02-09 22:55:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 897 bytes
コンパイル時間 3,928 ms
コンパイル使用メモリ 263,108 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-09 22:55:16
合計ジャッジ時間 6,745 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,676 KB
testcase_01 AC 3 ms
6,676 KB
testcase_02 AC 9 ms
6,676 KB
testcase_03 AC 10 ms
6,676 KB
testcase_04 AC 115 ms
6,676 KB
testcase_05 AC 9 ms
6,676 KB
testcase_06 AC 10 ms
6,676 KB
testcase_07 AC 10 ms
6,676 KB
testcase_08 AC 10 ms
6,676 KB
testcase_09 AC 9 ms
6,676 KB
testcase_10 AC 114 ms
6,676 KB
testcase_11 AC 3 ms
6,676 KB
testcase_12 AC 115 ms
6,676 KB
testcase_13 AC 114 ms
6,676 KB
testcase_14 AC 115 ms
6,676 KB
testcase_15 AC 116 ms
6,676 KB
testcase_16 AC 115 ms
6,676 KB
testcase_17 AC 116 ms
6,676 KB
testcase_18 AC 114 ms
6,676 KB
testcase_19 AC 115 ms
6,676 KB
testcase_20 AC 115 ms
6,676 KB
testcase_21 AC 115 ms
6,676 KB
testcase_22 AC 114 ms
6,676 KB
testcase_23 AC 114 ms
6,676 KB
testcase_24 AC 114 ms
6,676 KB
testcase_25 AC 114 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

// 

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const int INF = (int)(1e9);
const int MAX = (int)(1e5);
const ll mod = 998244353LL;

int main() {
	int n;
	cin >> n;
	vector<int> a(n);
	rep(i, n) cin >> a[i];
	vector<ll> dp(MAX+2);
	rep3(i, a[0], MAX+1) dp[i+1] = (1 + dp[i]) % mod;
	rep3(i, 1, n) {
		vector<ll> ndp(MAX+2);
		rep3(j, a[i], MAX+1) {
			int li = a[i-1], ri = min(j, j-a[i]+a[i-1]);
			if (li > ri) continue;
			ndp[j+1] = ((dp[ri+1]-dp[li]+mod) % mod + ndp[j]) % mod;
		}
		swap(ndp, dp);
	}
	cout << dp[MAX+1] << endl;
	return 0;
}
0