結果

問題 No.1532 Different Products
ユーザー optopt
提出日時 2021-06-04 23:13:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 630 ms / 4,000 ms
コード長 741 bytes
コンパイル時間 2,348 ms
コンパイル使用メモリ 207,536 KB
実行使用メモリ 346,960 KB
最終ジャッジ日時 2024-04-30 11:54:51
合計ジャッジ時間 24,493 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 7 ms
11,852 KB
testcase_01 AC 128 ms
162,768 KB
testcase_02 AC 25 ms
32,576 KB
testcase_03 AC 9 ms
13,772 KB
testcase_04 AC 16 ms
22,232 KB
testcase_05 AC 6 ms
9,676 KB
testcase_06 AC 16 ms
24,020 KB
testcase_07 AC 24 ms
34,256 KB
testcase_08 AC 27 ms
36,304 KB
testcase_09 AC 53 ms
69,584 KB
testcase_10 AC 121 ms
137,936 KB
testcase_11 AC 102 ms
120,920 KB
testcase_12 AC 264 ms
219,476 KB
testcase_13 AC 122 ms
126,416 KB
testcase_14 AC 506 ms
332,740 KB
testcase_15 AC 26 ms
32,528 KB
testcase_16 AC 180 ms
238,032 KB
testcase_17 AC 97 ms
114,524 KB
testcase_18 AC 70 ms
84,944 KB
testcase_19 AC 225 ms
199,376 KB
testcase_20 AC 486 ms
317,264 KB
testcase_21 AC 203 ms
259,820 KB
testcase_22 AC 140 ms
147,580 KB
testcase_23 AC 80 ms
91,856 KB
testcase_24 AC 438 ms
304,208 KB
testcase_25 AC 231 ms
234,312 KB
testcase_26 AC 71 ms
94,036 KB
testcase_27 AC 237 ms
293,328 KB
testcase_28 AC 176 ms
217,428 KB
testcase_29 AC 231 ms
309,844 KB
testcase_30 AC 282 ms
322,128 KB
testcase_31 AC 274 ms
314,448 KB
testcase_32 AC 302 ms
322,768 KB
testcase_33 AC 255 ms
305,412 KB
testcase_34 AC 388 ms
317,780 KB
testcase_35 AC 303 ms
318,928 KB
testcase_36 AC 363 ms
330,108 KB
testcase_37 AC 229 ms
307,604 KB
testcase_38 AC 411 ms
324,940 KB
testcase_39 AC 343 ms
316,876 KB
testcase_40 AC 358 ms
316,028 KB
testcase_41 AC 597 ms
341,584 KB
testcase_42 AC 504 ms
333,264 KB
testcase_43 AC 530 ms
331,944 KB
testcase_44 AC 605 ms
345,936 KB
testcase_45 AC 601 ms
346,244 KB
testcase_46 AC 579 ms
344,404 KB
testcase_47 AC 617 ms
346,740 KB
testcase_48 AC 599 ms
346,300 KB
testcase_49 AC 605 ms
346,316 KB
testcase_50 AC 610 ms
346,068 KB
testcase_51 AC 615 ms
346,576 KB
testcase_52 AC 606 ms
345,428 KB
testcase_53 AC 614 ms
346,832 KB
testcase_54 AC 597 ms
345,424 KB
testcase_55 AC 613 ms
346,324 KB
testcase_56 AC 576 ms
344,400 KB
testcase_57 AC 584 ms
346,960 KB
testcase_58 AC 605 ms
345,812 KB
testcase_59 AC 549 ms
342,480 KB
testcase_60 AC 630 ms
346,960 KB
testcase_61 AC 5 ms
9,684 KB
testcase_62 AC 5 ms
7,632 KB
testcase_63 AC 604 ms
346,188 KB
権限があれば一括ダウンロードができます

ソースコード

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;


constexpr int m = 4e5;
int pre[202][m+1];
unordered_map<ll, ll> memo[202];

ll dp(int n, ll k) {
  if (k <= m) return pre[n][k];
  if (n == 0) return 1;
  if (memo[n].count(k)) return memo[n][k];
  return memo[n][k] = dp(n-1, k) + dp(n-1, k/n);
}

int main() {
  ll n, k; cin >> n >> k;
  pre[0][1] = 1;
  rep(i, n) rep(j, m+1) {
    pre[i+1][j] += pre[i][j];
    int k = j * (i+1);
    if (k <= m) pre[i+1][k] += pre[i][j];
  }
  rep(i, 1, n+1) rep(j, m) pre[i][j+1] += pre[i][j];
  cout << (dp(n, k) - 1) << '\n';
}
0