結果

問題 No.2625 Bouns Ai
ユーザー maksimmaksim
提出日時 2024-02-09 22:12:46
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 157 ms / 2,000 ms
コード長 909 bytes
コンパイル時間 1,569 ms
コンパイル使用メモリ 167,468 KB
実行使用メモリ 6,548 KB
最終ジャッジ日時 2024-02-09 22:12:51
合計ジャッジ時間 5,239 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
#define int long long
#define all(x) x.begin(), x.end()
#define app push_back
#ifdef LOCAL
#define debug(...) [](auto...a){ ((cout << a << ' '), ...) << '\n';}(#__VA_ARGS__, ":", __VA_ARGS__)
#else
#define debug(...)
#endif
const int p=998244353;
const int maxn=1e5+5;
int dp[maxn];int pr[maxn];
int dp2[maxn];
int32_t main()
{
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    int n;cin>>n;int a[n];for(int i=0;i<n;++i) cin>>a[i];
    dp[0]=1;for(int i=1;i<maxn;++i) {pr[i]=pr[i-1]+dp[i-1];pr[i]%=p;}
    for(int j=0;j<n;++j)
    {
        fill(dp2,dp2+maxn,0LL);
        for(int k=a[j];k<=100000;++k)
        {
            int mx=0;if(j) mx=max(0LL,a[j]-a[j-1]);
            dp2[k]=pr[max(0LL,k-mx+1)];
        }
        copy(dp2,dp2+maxn,dp);for(int i=1;i<maxn;++i) {pr[i]=pr[i-1]+dp[i-1];pr[i]%=p;}
    }
    cout<<pr[maxn-1];
    return 0;
}
0