結果

問題 No.1353 Limited Sequence
ユーザー chocoruskchocorusk
提出日時 2021-01-21 01:27:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 112 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 1,269 ms
コンパイル使用メモリ 128,236 KB
実行使用メモリ 33,812 KB
最終ジャッジ日時 2023-08-25 10:51:32
合計ジャッジ時間 5,848 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,384 KB
testcase_05 AC 1 ms
4,384 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,384 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,384 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 55 ms
28,704 KB
testcase_13 AC 65 ms
32,652 KB
testcase_14 AC 9 ms
12,240 KB
testcase_15 AC 31 ms
20,328 KB
testcase_16 AC 5 ms
8,080 KB
testcase_17 AC 7 ms
10,200 KB
testcase_18 AC 56 ms
28,600 KB
testcase_19 AC 74 ms
30,748 KB
testcase_20 AC 20 ms
16,228 KB
testcase_21 AC 7 ms
12,128 KB
testcase_22 AC 7 ms
10,136 KB
testcase_23 AC 58 ms
28,528 KB
testcase_24 AC 41 ms
26,468 KB
testcase_25 AC 68 ms
28,584 KB
testcase_26 AC 36 ms
22,364 KB
testcase_27 AC 24 ms
22,436 KB
testcase_28 AC 13 ms
14,360 KB
testcase_29 AC 16 ms
22,368 KB
testcase_30 AC 51 ms
32,672 KB
testcase_31 AC 30 ms
24,416 KB
testcase_32 AC 22 ms
23,212 KB
testcase_33 AC 6 ms
12,388 KB
testcase_34 AC 39 ms
31,232 KB
testcase_35 AC 13 ms
17,404 KB
testcase_36 AC 17 ms
18,852 KB
testcase_37 AC 106 ms
33,512 KB
testcase_38 AC 102 ms
33,492 KB
testcase_39 AC 102 ms
33,500 KB
testcase_40 AC 105 ms
33,812 KB
testcase_41 AC 107 ms
33,544 KB
testcase_42 AC 104 ms
33,500 KB
testcase_43 AC 112 ms
33,572 KB
testcase_44 AC 110 ms
33,552 KB
testcase_45 AC 103 ms
33,504 KB
testcase_46 AC 109 ms
33,508 KB
testcase_47 AC 47 ms
33,556 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <cstring>
#include <iostream>
#include <string>
#include <cmath>
#include <bitset>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <deque>
#include <algorithm>
#include <complex>
#include <unordered_map>
#include <unordered_set>
#include <random>
#include <cassert>
#include <fstream>
#include <utility>
#include <functional>
#include <stack>
#include <array>
#include <list>
#define popcount __builtin_popcount
using namespace std;
typedef long long int ll;
typedef pair<int, int> P;
const ll MOD=998244353;
ll dp[2020][2020];
ll s[2020];
int main()
{
    int n, l, r;
    cin>>n>>l>>r;
    int a[2020];
    for(int i=1; i<=n; i++) cin>>a[i];
    for(int i=1; i<=min(r, n); i++){
        for(int j=1; j<=a[i] && j*i<=r; j++){
            dp[i*j][i]=1;
        }
    }
    ll ans=0;
    for(int i=1; i<=r; i++){
        for(int j=1; j<=min(r, n); j++){
            for(int c=1; c<=a[j] && j*c<i; c++){
                dp[i][j]+=s[i-j*c]+MOD-dp[i-j*c][j];
                dp[i][j]%=MOD;
            }
            (s[i]+=dp[i][j])%=MOD;
        }
        if(i>=l) (ans+=s[i])%=MOD;
    }
    cout<<ans<<endl;
    return 0;
}
0