結果

問題 No.1532 Different Products
ユーザー opt
提出日時 2021-06-05 11:14:18
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2,892 ms / 4,000 ms
コード長 496 bytes
コンパイル時間 3,765 ms
コンパイル使用メモリ 200,624 KB
最終ジャッジ日時 2025-01-22 03:31:11
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 62
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep_(i, a_, b_, a, b, ...) for (int i = (a), lim##i = (b); i < lim##i; ++i)
#define rep(i, ...) rep_(i, __VA_ARGS__, __VA_ARGS__, 0, __VA_ARGS__)
using ll = long long;

int main() {
  ll n, k; cin >> n >> k;
  unordered_map<ll, ll> dp;
  dp[k] = 1;
  rep(i, 1, n+1) {
    unordered_map<ll, ll> tmp(dp);
    for (auto [x, y] : tmp) if (x >= i) dp[x/i] += y;
  }
  ll ans = -1;
  for (auto [x, y] : dp) if (x) ans += y;
  cout << ans << '\n';
}
0