結果

問題 No.1532 Different Products
ユーザー だれだれ
提出日時 2021-06-04 21:10:42
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 1,945 bytes
コンパイル時間 5,653 ms
コンパイル使用メモリ 224,472 KB
実行使用メモリ 199,864 KB
最終ジャッジ日時 2023-11-30 11:01:39
合計ジャッジ時間 138,338 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 445 ms
40,064 KB
testcase_02 AC 3 ms
6,676 KB
testcase_03 AC 1 ms
6,676 KB
testcase_04 AC 1 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 80 ms
13,312 KB
testcase_10 AC 631 ms
46,772 KB
testcase_11 AC 434 ms
35,764 KB
testcase_12 AC 1,852 ms
110,292 KB
testcase_13 AC 771 ms
54,000 KB
testcase_14 AC 2,967 ms
164,860 KB
testcase_15 AC 7 ms
6,676 KB
testcase_16 AC 558 ms
45,092 KB
testcase_17 AC 423 ms
35,136 KB
testcase_18 AC 232 ms
25,500 KB
testcase_19 AC 1,748 ms
107,292 KB
testcase_20 AC 2,927 ms
167,916 KB
testcase_21 AC 766 ms
61,376 KB
testcase_22 AC 940 ms
64,228 KB
testcase_23 AC 351 ms
31,752 KB
testcase_24 AC 2,857 ms
156,700 KB
testcase_25 AC 1,441 ms
94,784 KB
testcase_26 AC 90 ms
14,848 KB
testcase_27 AC 1,189 ms
80,148 KB
testcase_28 AC 836 ms
63,360 KB
testcase_29 AC 855 ms
61,916 KB
testcase_30 AC 1,758 ms
107,096 KB
testcase_31 AC 1,717 ms
107,408 KB
testcase_32 AC 1,986 ms
122,208 KB
testcase_33 AC 1,443 ms
96,204 KB
testcase_34 AC 2,425 ms
145,988 KB
testcase_35 AC 2,471 ms
121,276 KB
testcase_36 AC 2,964 ms
143,636 KB
testcase_37 AC 467 ms
43,264 KB
testcase_38 AC 2,552 ms
151,984 KB
testcase_39 AC 2,446 ms
136,960 KB
testcase_40 AC 2,406 ms
139,696 KB
testcase_41 AC 3,585 ms
190,944 KB
testcase_42 AC 3,169 ms
171,932 KB
testcase_43 AC 3,332 ms
179,152 KB
testcase_44 AC 3,673 ms
195,736 KB
testcase_45 AC 3,725 ms
197,396 KB
testcase_46 AC 3,758 ms
188,592 KB
testcase_47 AC 3,956 ms
199,492 KB
testcase_48 TLE -
testcase_49 TLE -
testcase_50 TLE -
testcase_51 TLE -
testcase_52 AC 3,911 ms
193,680 KB
testcase_53 TLE -
testcase_54 AC 3,916 ms
193,596 KB
testcase_55 AC 3,969 ms
197,404 KB
testcase_56 AC 3,839 ms
188,428 KB
testcase_57 AC 3,916 ms
190,044 KB
testcase_58 TLE -
testcase_59 AC 3,782 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 #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
#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 memo[n][k] = 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