結果

問題 No.1532 Different Products
ユーザー だれだれ
提出日時 2021-06-04 21:06:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,841 bytes
コンパイル時間 3,751 ms
コンパイル使用メモリ 191,820 KB
実行使用メモリ 199,864 KB
最終ジャッジ日時 2023-12-15 05:21:33
合計ジャッジ時間 143,671 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 572 ms
40,064 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 2 ms
6,676 KB
testcase_05 AC 2 ms
6,676 KB
testcase_06 AC 2 ms
6,676 KB
testcase_07 AC 3 ms
6,676 KB
testcase_08 AC 5 ms
6,676 KB
testcase_09 AC 114 ms
13,312 KB
testcase_10 AC 787 ms
46,772 KB
testcase_11 AC 537 ms
35,764 KB
testcase_12 AC 2,190 ms
110,292 KB
testcase_13 AC 958 ms
54,000 KB
testcase_14 AC 3,391 ms
164,860 KB
testcase_15 AC 7 ms
6,676 KB
testcase_16 AC 684 ms
45,092 KB
testcase_17 AC 541 ms
35,136 KB
testcase_18 AC 322 ms
25,500 KB
testcase_19 AC 2,169 ms
107,292 KB
testcase_20 AC 3,462 ms
167,916 KB
testcase_21 AC 1,009 ms
61,376 KB
testcase_22 AC 1,186 ms
64,228 KB
testcase_23 AC 447 ms
31,752 KB
testcase_24 AC 3,208 ms
156,700 KB
testcase_25 AC 1,712 ms
94,784 KB
testcase_26 AC 118 ms
14,848 KB
testcase_27 AC 1,399 ms
80,148 KB
testcase_28 AC 1,023 ms
63,360 KB
testcase_29 AC 999 ms
61,916 KB
testcase_30 AC 2,028 ms
107,096 KB
testcase_31 AC 2,045 ms
107,408 KB
testcase_32 AC 2,335 ms
122,208 KB
testcase_33 AC 1,768 ms
96,204 KB
testcase_34 AC 2,946 ms
145,988 KB
testcase_35 AC 2,336 ms
121,276 KB
testcase_36 AC 2,822 ms
143,636 KB
testcase_37 AC 603 ms
43,264 KB
testcase_38 AC 3,041 ms
151,984 KB
testcase_39 AC 2,705 ms
136,960 KB
testcase_40 AC 2,746 ms
139,696 KB
testcase_41 TLE -
testcase_42 AC 3,515 ms
171,932 KB
testcase_43 AC 3,766 ms
179,152 KB
testcase_44 TLE -
testcase_45 TLE -
testcase_46 AC 3,932 ms
188,592 KB
testcase_47 TLE -
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
testcase_55 TLE -
testcase_56 AC 3,916 ms
188,428 KB
testcase_57 AC 3,879 ms
190,044 KB
testcase_58 TLE -
testcase_59 AC 3,763 ms
183,312 KB
testcase_60 TLE -
testcase_61 AC 2 ms
6,676 KB
testcase_62 AC 2 ms
6,676 KB
testcase_63 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <algorithm>
#include <bitset>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <fstream>
#include <functional>
#include <iomanip>
#include <iostream>
#include <iterator>
#include <map>
#include <numeric>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <unordered_set>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif
#define GET_MACRO(_1, _2, _3, NAME, ...) NAME
#define _rep(i, n) _rep2(i, 0, n)
#define _rep2(i, a, b) for(int i = (int)(a); i < (int)(b); i++)
#define rep(...) GET_MACRO(__VA_ARGS__, _rep2, _rep)(__VA_ARGS__)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
using i64 = long long;
template<class T, class U>
bool chmin(T& a, const U& b) { return (b < a) ? (a = b, true) : false; }
template<class T, class U>
bool chmax(T& a, const U& b) { return (b > a) ? (a = b, true) : false; }

template<typename T>istream& operator>>(istream&i,vector<T>&v){rep(j,v.size())i>>v[j];return i;}
template<typename T>string join(vector<T>&v){stringstream s;rep(i,v.size())s<<' '<<v[i];return s.str().substr(1);}
template<typename T>ostream& operator<<(ostream&o,vector<T>&v){if(v.size())o<<join(v);return o;}
template<typename T>string join(vector<vector<T>>&vv){string s="\n";rep(i,vv.size())s+=join(vv[i])+"\n";return s;}
template<typename T>ostream& operator<<(ostream&o,vector<vector<T>>&vv){if(vv.size())o<<join(vv);return o;}

vector<unordered_map<i64, i64>> memo;

i64 solve(int n, i64 k){
    if (memo[n][k]) return memo[n][k];
    if (n == 1) return 2;
    i64 res = 0;
    if (k >= n) res += solve(n - 1, k / n);
    res += solve(n - 1, k);
    return memo[n][k] = res;
}

int main()
{
    int n;
    i64 k;
    cin >> n >> k;
    memo.resize(n + 1);
    cout << solve(n, k) - 1 << endl;
}
0