結果

問題 No.1532 Different Products
コンテスト
ユーザー chineristAC
提出日時 2021-05-02 19:49:10
言語 C++17(gcc12)
(gcc 12.4.0 + boost 1.90.0)
コンパイル:
g++-12 -O2 -lm -std=c++17 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 121 ms / 4,000 ms
コード長 1,522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 5,483 ms
コンパイル使用メモリ 268,308 KB
実行使用メモリ 6,400 KB
最終ジャッジ日時 2026-06-20 03:34:39
合計ジャッジ時間 11,605 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#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 "testlib.h"
#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;
  }
}

const long long MIN_N = 1;
const long long MAX_N = 200;
const long long MIN_K = 1;
const long long MAX_K = 10000000000;


int main(int argc, char* argv[]){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);

  registerValidation(argc,argv);
  ll N = inf.readLong(MIN_N,MAX_N,"N");
  inf.readSpace();
  ll K = inf.readLong(MIN_K,MAX_K,"K");
  inf.readEoln();
  inf.readEof();

  ll M = ceil(sqrt(K));
  M = min(K,M);

  vector<ll> res(M+1,1);
  vector<ll> Res(M+1,1);

  res[0] = 0;
  Res[0] = 1;
  for (ll n=1;n<N+1;n++){
    for (ll i=1;i<M+1;i++){
      if (i*n<=M){
        Res[i] += Res[i*n];
      }
      else{
        Res[i] += res[K/(n*i)];
      }
    }
    for (ll i=M;i>n-1;i--){
      res[i] += res[i/n];
    }
  }

  cout<<Res[1]-1<<endl;


  


  


}
0