結果

問題 No.1353 Limited Sequence
ユーザー 👑 PCTprobabilityPCTprobability
提出日時 2021-01-14 19:06:49
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,531 bytes
コンパイル時間 7,841 ms
コンパイル使用メモリ 163,904 KB
実行使用メモリ 34,816 KB
最終ジャッジ日時 2024-05-03 12:05:54
合計ジャッジ時間 4,725 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
5,248 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 21 ms
15,104 KB
testcase_33 AC 8 ms
8,320 KB
testcase_34 AC 41 ms
21,376 KB
testcase_35 AC 12 ms
9,344 KB
testcase_36 AC 14 ms
9,976 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 WA -
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 AC 56 ms
34,652 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using ld = long double;
#define all(s) (s).begin(),(s).end()
#define vcin(n) for(ll i=0;i<ll(n.size());i++) cin>>n[i]
#define rever(vec) reverse(vec.begin(), vec.end())
#define sor(vec) sort(vec.begin(), vec.end())
#define fi first
#define se second
const ll mod = 998244353;
//const ll mod = 1000000007;
const ll inf = 2000000000000000000ll;
static const long double pi = 3.141592653589793;
template<class T,class U> void chmax(T& t,const U& u){if(t<u) t=u;}
template<class T,class U> void chmin(T& t,const U& u){if(t>u) t=u;}
ll modPow(ll a, ll n, ll mod) { ll ret = 1; ll p = a % mod; while (n) { if (n & 1) ret = ret * p % mod; p = p * p % mod; n >>= 1; } return ret; }
int main() {
  /* mod は 1e9+7 */
  ios::sync_with_stdio(false);
    std::cin.tie(nullptr);
  cout<< fixed << setprecision(10);
  ll n,l,r;
  cin>>n>>l>>r;
  vector<ll> a(n);
 // vcin(a);
  for(int i=0;i<n;i++){
    a[i]=1;
  }
  ll dp[r+1][n+1];
  ll sum[r+1];
  for(int i=0;i<=r;i++){
    for(int j=0;j<=n;j++){
      dp[i][j]=0;
    }
  }
  for(int i=0;i<=r;i++){
    sum[i]=0;
  }
  dp[0][0]=1;
  sum[0]=1;
  for(int i=0;i<=r;i++){
    for(int j=1;j<=n;j++){
      ll t=dp[i][j];
      for(int k=1;j*k<=i&&k<=a[j-1];k++){
        t+=sum[i-k*j]-dp[i-k*j][j];
        t%=mod;
        t+=mod;
        t%=mod;
      }
      t%=mod;
      dp[i][j]=t;
      sum[i]+=t;
      sum[i]%=mod;
    }
  }
  ll ans=0;
  for(int i=l;i<=r;i++){
    ans+=sum[i];
    ans%=mod;
  }
  cout<<ans<<endl;
}
0