結果

問題 No.1353 Limited Sequence
ユーザー blackyukiblackyuki
提出日時 2021-01-15 18:20:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 240 ms / 2,000 ms
コード長 600 bytes
コンパイル時間 2,008 ms
コンパイル使用メモリ 202,932 KB
実行使用メモリ 19,256 KB
最終ジャッジ日時 2023-08-17 13:05:51
合計ジャッジ時間 7,807 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 126 ms
9,956 KB
testcase_13 AC 141 ms
7,864 KB
testcase_14 AC 15 ms
7,532 KB
testcase_15 AC 55 ms
12,136 KB
testcase_16 AC 5 ms
4,504 KB
testcase_17 AC 10 ms
5,696 KB
testcase_18 AC 98 ms
9,648 KB
testcase_19 AC 152 ms
15,432 KB
testcase_20 AC 31 ms
7,152 KB
testcase_21 AC 10 ms
4,380 KB
testcase_22 AC 10 ms
5,404 KB
testcase_23 AC 101 ms
9,128 KB
testcase_24 AC 71 ms
7,136 KB
testcase_25 AC 128 ms
12,936 KB
testcase_26 AC 61 ms
7,900 KB
testcase_27 AC 40 ms
5,192 KB
testcase_28 AC 22 ms
8,260 KB
testcase_29 AC 28 ms
4,376 KB
testcase_30 AC 101 ms
6,632 KB
testcase_31 AC 55 ms
6,384 KB
testcase_32 AC 17 ms
9,120 KB
testcase_33 AC 6 ms
6,040 KB
testcase_34 AC 27 ms
12,164 KB
testcase_35 AC 10 ms
6,384 KB
testcase_36 AC 11 ms
7,040 KB
testcase_37 AC 231 ms
19,148 KB
testcase_38 AC 219 ms
19,128 KB
testcase_39 AC 224 ms
19,144 KB
testcase_40 AC 232 ms
19,256 KB
testcase_41 AC 240 ms
19,092 KB
testcase_42 AC 222 ms
19,144 KB
testcase_43 AC 240 ms
19,196 KB
testcase_44 AC 232 ms
19,080 KB
testcase_45 AC 223 ms
19,152 KB
testcase_46 AC 237 ms
19,148 KB
testcase_47 AC 45 ms
19,132 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int mod=998244353;
int main(){
    int n,l,r,ans=0;cin>>n>>l>>r;
    vector<int> A(n+1);for(int i=1;i<=n;i++)cin>>A[i];
    vector<vector<int>> dp(r+1,vector<int>(n+1));dp[0][0]++;
    vector<int> dp_sum(r+1);dp_sum[0]++;
    for(int s=1;s<=r;s++)for(int lst=1;lst<=n;lst++)for(int t=1;t*lst<=s&&t<=A[lst];t++){
        dp[s][lst]=((dp[s][lst]+dp_sum[s-t*lst]-dp[s-t*lst][lst])%mod+mod)%mod;
        dp_sum[s]=((dp_sum[s]+dp_sum[s-t*lst]-dp[s-t*lst][lst])%mod+mod)%mod;
    }
    for(int i=l;i<=r;i++)ans=(ans+dp_sum[i])%mod;
    cout<<ans<<endl;
}
0