結果

問題 No.1353 Limited Sequence
ユーザー shiomusubi496shiomusubi496
提出日時 2021-01-17 14:02:56
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 201 ms / 2,000 ms
コード長 697 bytes
コンパイル時間 1,577 ms
コンパイル使用メモリ 166,876 KB
実行使用メモリ 36,320 KB
最終ジャッジ日時 2024-05-07 02:47:15
合計ジャッジ時間 6,055 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 3 ms
5,376 KB
testcase_12 AC 118 ms
30,336 KB
testcase_13 AC 141 ms
35,200 KB
testcase_14 AC 29 ms
13,696 KB
testcase_15 AC 53 ms
21,684 KB
testcase_16 AC 12 ms
8,832 KB
testcase_17 AC 15 ms
10,496 KB
testcase_18 AC 77 ms
29,952 KB
testcase_19 AC 201 ms
31,360 KB
testcase_20 AC 42 ms
18,176 KB
testcase_21 AC 12 ms
13,056 KB
testcase_22 AC 15 ms
11,648 KB
testcase_23 AC 120 ms
30,444 KB
testcase_24 AC 51 ms
27,096 KB
testcase_25 AC 156 ms
30,552 KB
testcase_26 AC 64 ms
23,936 KB
testcase_27 AC 28 ms
22,784 KB
testcase_28 AC 32 ms
15,232 KB
testcase_29 AC 22 ms
24,320 KB
testcase_30 AC 68 ms
33,408 KB
testcase_31 AC 41 ms
24,780 KB
testcase_32 AC 44 ms
26,180 KB
testcase_33 AC 21 ms
13,312 KB
testcase_34 AC 83 ms
35,432 KB
testcase_35 AC 26 ms
21,888 KB
testcase_36 AC 47 ms
26,888 KB
testcase_37 AC 155 ms
36,296 KB
testcase_38 AC 145 ms
36,140 KB
testcase_39 AC 151 ms
36,260 KB
testcase_40 AC 150 ms
36,312 KB
testcase_41 AC 157 ms
36,264 KB
testcase_42 AC 147 ms
36,292 KB
testcase_43 AC 158 ms
36,292 KB
testcase_44 AC 151 ms
36,224 KB
testcase_45 AC 154 ms
36,316 KB
testcase_46 AC 151 ms
36,276 KB
testcase_47 AC 90 ms
36,320 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