結果

問題 No.1353 Limited Sequence
ユーザー chocoruskchocorusk
提出日時 2021-01-21 01:27:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 145 ms / 2,000 ms
コード長 1,175 bytes
コンパイル時間 1,825 ms
コンパイル使用メモリ 129,024 KB
実行使用メモリ 26,112 KB
最終ジャッジ日時 2024-06-06 05:34:30
合計ジャッジ時間 4,962 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 69 ms
18,816 KB
testcase_13 AC 87 ms
18,560 KB
testcase_14 AC 11 ms
7,424 KB
testcase_15 AC 36 ms
12,800 KB
testcase_16 AC 5 ms
5,376 KB
testcase_17 AC 7 ms
5,760 KB
testcase_18 AC 71 ms
18,816 KB
testcase_19 AC 92 ms
21,504 KB
testcase_20 AC 21 ms
10,240 KB
testcase_21 AC 8 ms
6,784 KB
testcase_22 AC 9 ms
6,400 KB
testcase_23 AC 72 ms
18,304 KB
testcase_24 AC 49 ms
14,848 KB
testcase_25 AC 86 ms
20,480 KB
testcase_26 AC 42 ms
14,208 KB
testcase_27 AC 26 ms
11,136 KB
testcase_28 AC 14 ms
8,320 KB
testcase_29 AC 19 ms
9,984 KB
testcase_30 AC 64 ms
16,256 KB
testcase_31 AC 37 ms
13,184 KB
testcase_32 AC 26 ms
16,256 KB
testcase_33 AC 8 ms
7,296 KB
testcase_34 AC 46 ms
23,808 KB
testcase_35 AC 17 ms
12,032 KB
testcase_36 AC 21 ms
14,464 KB
testcase_37 AC 145 ms
26,112 KB
testcase_38 AC 138 ms
26,112 KB
testcase_39 AC 135 ms
26,112 KB
testcase_40 AC 141 ms
25,984 KB
testcase_41 AC 139 ms
26,112 KB
testcase_42 AC 134 ms
26,112 KB
testcase_43 AC 140 ms
26,112 KB
testcase_44 AC 140 ms
26,112 KB
testcase_45 AC 135 ms
25,984 KB
testcase_46 AC 139 ms
26,112 KB
testcase_47 AC 62 ms
26,112 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