結果

問題 No.1532 Different Products
ユーザー chineristACchineristAC
提出日時 2021-05-02 04:50:30
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
(最新)
AC  
(最初)
実行時間 -
コード長 1,614 bytes
コンパイル時間 1,307 ms
コンパイル使用メモリ 129,604 KB
実行使用メモリ 16,868 KB
最終ジャッジ日時 2023-09-28 07:49:13
合計ジャッジ時間 27,414 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 3 ms
4,476 KB
testcase_08 AC 3 ms
4,532 KB
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 AC 36 ms
8,904 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 AC 523 ms
16,772 KB
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 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 WA -
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 AC 1 ms
4,376 KB
testcase_62 AC 1 ms
4,380 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <set>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <random>
#include <stdio.h>
#include <fstream>
//#include <atcoder/all>
#include <functional>
using namespace std;
//using namespace atcoder;

using ll = long long;
using pll = pair<ll,ll>;
//using mint = modint998244353;

#define all(i) (i).begin(),(i).end()
#define pb push_back
#define INF 100000000000000000

#define rep(i,n) for (int i=0;i<n;i++)
#define rep2(l,r) for (int i=l;i<r;i++)


bool chmin(ll &x,ll a){
  if (x > a){
    x = a;
    return 1;
  }
  else{
    return 0;
  }
}

bool chmax(ll &x,ll a){
  if (x < a){
    x = a;
    return 1;
  }
  else{
    return 0;
  }
}

int dp[210][10001];

void calc(int N){
  dp[N+1][1] = 1;
  for (int i=N;i>=1;i--){
    for (int prod=1;prod<10001;prod++){
      dp[i][prod] += dp[i+1][prod];
      if (prod*i < 10001){
        dp[i][prod*i] += dp[i+1][prod];
      }
    }
  }
  for (int i=0;i<N+2;i++){
    for (int j=1;j<10001;j++){
      dp[i][j] += dp[i][j-1];
    }
  }
}

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  int N,K;
  cin>>N>>K;

  calc(N);

  queue<pair<int,int>> A;
  A.push(make_pair(1,1));
  ll res=-1;
  while (!A.empty()){
    auto [val,L] = A.front();
    A.pop();
    res += 1;
    for (int i=L;i<=N;i++){
      if (val*i<=K){
        if (val*i>=100000){
          res += dp[i+1][K/(val*i)];
        }
        else{
          A.push({val*i,i+1});
        }
      }
      else{
        break;
      }
    }
  }
  cout<<res%998244353<<endl;

}
0