結果

問題 No.1353 Limited Sequence
ユーザー shiomusubi496shiomusubi496
提出日時 2021-01-17 14:02:56
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 183 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 1,560 ms
コンパイル使用メモリ 165,520 KB
実行使用メモリ 36,264 KB
最終ジャッジ日時 2023-08-19 19:52:22
合計ジャッジ時間 6,290 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,628 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 3 ms
4,980 KB
testcase_08 AC 2 ms
4,596 KB
testcase_09 AC 3 ms
4,672 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 108 ms
32,036 KB
testcase_13 AC 125 ms
36,060 KB
testcase_14 AC 28 ms
13,632 KB
testcase_15 AC 51 ms
21,632 KB
testcase_16 AC 12 ms
9,332 KB
testcase_17 AC 15 ms
11,480 KB
testcase_18 AC 69 ms
29,800 KB
testcase_19 AC 183 ms
31,964 KB
testcase_20 AC 40 ms
19,732 KB
testcase_21 AC 12 ms
13,456 KB
testcase_22 AC 15 ms
13,616 KB
testcase_23 AC 108 ms
31,952 KB
testcase_24 AC 45 ms
27,848 KB
testcase_25 AC 138 ms
32,060 KB
testcase_26 AC 58 ms
25,804 KB
testcase_27 AC 26 ms
23,660 KB
testcase_28 AC 30 ms
15,576 KB
testcase_29 AC 20 ms
25,708 KB
testcase_30 AC 57 ms
34,080 KB
testcase_31 AC 36 ms
25,808 KB
testcase_32 AC 37 ms
27,864 KB
testcase_33 AC 19 ms
13,572 KB
testcase_34 AC 71 ms
36,064 KB
testcase_35 AC 24 ms
23,764 KB
testcase_36 AC 41 ms
27,820 KB
testcase_37 AC 139 ms
36,236 KB
testcase_38 AC 134 ms
36,232 KB
testcase_39 AC 133 ms
36,108 KB
testcase_40 AC 136 ms
36,160 KB
testcase_41 AC 138 ms
36,264 KB
testcase_42 AC 134 ms
36,160 KB
testcase_43 AC 140 ms
36,124 KB
testcase_44 AC 135 ms
36,236 KB
testcase_45 AC 132 ms
36,220 KB
testcase_46 AC 136 ms
36,244 KB
testcase_47 AC 77 ms
36,240 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int mod=998244353;
void add(int&a,int b){a=(a+b+mod)%mod;}
int N,dp[2100][2100],V[2100],A[2100];
int f(int X){
    fill(dp[0],dp[X+1],0);
    dp[0][N]=1;
    for(int i=0;i<X;i++){
        int sum=0;
        for(int j=0;j<=N;j++)add(sum,dp[i][j]);
        for(int k=0;k<N;k++){
            for(int l=1;i+l*(k+1)<=X&&l<=A[k];l++){
                add(dp[i+l*(k+1)][k],sum-dp[i][k]);
            }
        }
    }
    int ans=0;
    for(int i=0;i<=X;i++)for(int j=0;j<N;j++)add(ans,dp[i][j]);
    return ans;
}
signed main(){
    int L,R;cin>>N>>L>>R;
    for(int i=0;i<N;i++)cin>>A[i];
    cout<<(f(R)-f(L-1)+mod)%mod<<endl;
}
0