結果

問題 No.1532 Different Products
ユーザー sapphire__15sapphire__15
提出日時 2021-06-04 21:59:08
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,480 ms / 4,000 ms
コード長 1,908 bytes
コンパイル時間 1,416 ms
コンパイル使用メモリ 134,088 KB
実行使用メモリ 192,104 KB
最終ジャッジ日時 2023-08-12 12:58:26
合計ジャッジ時間 81,693 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 334 ms
41,988 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,384 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 4 ms
4,380 KB
testcase_09 AC 62 ms
12,684 KB
testcase_10 AC 404 ms
45,156 KB
testcase_11 AC 330 ms
42,140 KB
testcase_12 AC 1,137 ms
101,932 KB
testcase_13 AC 519 ms
49,144 KB
testcase_14 AC 1,936 ms
166,704 KB
testcase_15 AC 6 ms
4,384 KB
testcase_16 AC 367 ms
43,796 KB
testcase_17 AC 274 ms
30,788 KB
testcase_18 AC 184 ms
23,316 KB
testcase_19 AC 1,114 ms
99,272 KB
testcase_20 AC 2,004 ms
169,596 KB
testcase_21 AC 555 ms
55,676 KB
testcase_22 AC 630 ms
57,384 KB
testcase_23 AC 258 ms
28,400 KB
testcase_24 AC 1,926 ms
164,380 KB
testcase_25 AC 973 ms
90,200 KB
testcase_26 AC 76 ms
13,740 KB
testcase_27 AC 861 ms
82,484 KB
testcase_28 AC 573 ms
57,260 KB
testcase_29 AC 519 ms
56,284 KB
testcase_30 AC 1,074 ms
99,392 KB
testcase_31 AC 1,072 ms
99,968 KB
testcase_32 AC 1,239 ms
110,352 KB
testcase_33 AC 1,011 ms
92,528 KB
testcase_34 AC 1,726 ms
164,436 KB
testcase_35 AC 1,390 ms
109,868 KB
testcase_36 AC 1,834 ms
164,564 KB
testcase_37 AC 323 ms
42,812 KB
testcase_38 AC 1,753 ms
164,428 KB
testcase_39 AC 1,578 ms
164,488 KB
testcase_40 AC 1,583 ms
164,296 KB
testcase_41 AC 2,266 ms
187,544 KB
testcase_42 AC 2,028 ms
172,476 KB
testcase_43 AC 2,100 ms
178,284 KB
testcase_44 AC 2,232 ms
189,624 KB
testcase_45 AC 2,234 ms
190,252 KB
testcase_46 AC 2,202 ms
185,696 KB
testcase_47 AC 2,247 ms
191,584 KB
testcase_48 AC 2,167 ms
189,872 KB
testcase_49 AC 2,188 ms
190,832 KB
testcase_50 AC 2,157 ms
189,624 KB
testcase_51 AC 2,222 ms
191,248 KB
testcase_52 AC 2,203 ms
188,608 KB
testcase_53 AC 2,241 ms
191,720 KB
testcase_54 AC 2,251 ms
188,348 KB
testcase_55 AC 2,240 ms
190,568 KB
testcase_56 AC 2,179 ms
185,760 KB
testcase_57 AC 2,211 ms
186,764 KB
testcase_58 AC 2,242 ms
189,364 KB
testcase_59 AC 2,170 ms
181,548 KB
testcase_60 AC 2,480 ms
192,104 KB
testcase_61 AC 2 ms
4,380 KB
testcase_62 AC 1 ms
4,384 KB
testcase_63 AC 2,345 ms
190,184 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <queue>
#include <bitset>
#include <climits>
#include <cmath>
#include <complex>
#include <functional>
#include <cassert>
#include <stack>
#include <numeric>
#include <iomanip>
#include <limits>
#include <random>
#include <unordered_map>
#include <chrono>

typedef int64_t ll;
typedef std::pair<int, int> Pii;
typedef std::pair<ll, ll> Pll;
typedef std::pair<double, double> Pdd;

#define rip(_i, _n, _s) for (int _i = (_s); _i < (int)(_n); _i++)
#define all(_l) _l.begin(), _l.end()
#define rall(_l) _l.rbegin(), _l.rend()
#define MM << " " <<

template<typename _T>
using MaxHeap = std::priority_queue<_T>;
template<typename _T>
using MinHeap = std::priority_queue<_T, std::vector<_T>, std::greater<_T>>;

template<typename _T>
inline bool chmax(_T &_l, const _T _b) {
    if (_l < _b) {
        _l = _b;
        return true;
    }
    return false;
}
template<typename _T>
inline bool chmin(_T &_l, const _T _b) {
    if (_l > _b) {
        _l = _b;
        return true;
    }
    return false;
}

template<typename _T>
void vdeb(const std::vector<_T> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        if (i == bb.size() - 1) std::cout << bb[i];
        else std::cout << bb[i] << ' ';
    }
    std::cout << '\n';
}
template<typename _T>
void vdeb(const std::vector<std::vector<_T>> &bb) {
    for (unsigned int i = 0;i < bb.size();i++) {
        // std::cout << i << ' ';
        vdeb(bb[i]);
    }
    std::cout << '\n';
}

using namespace std;

int main() {
    ll n, k; cin >> n >> k;
    unordered_map<ll, ll> mp;
    auto rec = [&](auto &&f, ll x, ll y) -> ll {
        if(y == 1) return 2;
        if(mp.count(x*1000+y)) return mp[x*1000+y];
        if(x < y) return mp[x*1000+y] = f(f, x, y-1);
        return mp[x*1000+y] = f(f, x, y-1) + f(f, x/y, y-1);
    };
    cout << rec(rec, k, n)-1 << endl;
}
0