結果

問題 No.1532 Different Products
ユーザー fumofumofunifumofumofuni
提出日時 2022-01-17 16:36:46
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2,660 ms / 4,000 ms
コード長 1,386 bytes
コンパイル時間 1,983 ms
コンパイル使用メモリ 204,928 KB
実行使用メモリ 195,068 KB
最終ジャッジ日時 2023-08-15 07:02:15
合計ジャッジ時間 84,793 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,384 KB
testcase_01 AC 286 ms
42,044 KB
testcase_02 AC 2 ms
4,384 KB
testcase_03 AC 2 ms
4,384 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 4 ms
4,384 KB
testcase_09 AC 57 ms
12,884 KB
testcase_10 AC 387 ms
46,468 KB
testcase_11 AC 326 ms
42,000 KB
testcase_12 AC 1,160 ms
103,284 KB
testcase_13 AC 481 ms
50,712 KB
testcase_14 AC 2,075 ms
169,024 KB
testcase_15 AC 8 ms
4,380 KB
testcase_16 AC 368 ms
44,636 KB
testcase_17 AC 293 ms
42,116 KB
testcase_18 AC 163 ms
24,408 KB
testcase_19 AC 1,070 ms
100,972 KB
testcase_20 AC 1,919 ms
171,764 KB
testcase_21 AC 457 ms
56,600 KB
testcase_22 AC 574 ms
58,708 KB
testcase_23 AC 210 ms
29,472 KB
testcase_24 AC 1,892 ms
164,384 KB
testcase_25 AC 997 ms
91,732 KB
testcase_26 AC 66 ms
14,172 KB
testcase_27 AC 828 ms
82,944 KB
testcase_28 AC 550 ms
58,632 KB
testcase_29 AC 512 ms
56,796 KB
testcase_30 AC 1,113 ms
100,932 KB
testcase_31 AC 1,070 ms
101,436 KB
testcase_32 AC 1,261 ms
112,064 KB
testcase_33 AC 968 ms
93,816 KB
testcase_34 AC 1,897 ms
164,420 KB
testcase_35 AC 1,462 ms
111,504 KB
testcase_36 AC 1,981 ms
164,284 KB
testcase_37 AC 355 ms
43,156 KB
testcase_38 AC 2,083 ms
164,348 KB
testcase_39 AC 1,891 ms
164,512 KB
testcase_40 AC 1,914 ms
164,320 KB
testcase_41 AC 2,538 ms
190,108 KB
testcase_42 AC 2,342 ms
174,940 KB
testcase_43 AC 2,391 ms
180,604 KB
testcase_44 AC 2,584 ms
192,296 KB
testcase_45 AC 2,660 ms
192,776 KB
testcase_46 AC 2,529 ms
188,356 KB
testcase_47 AC 2,452 ms
194,664 KB
testcase_48 AC 2,357 ms
192,524 KB
testcase_49 AC 2,454 ms
193,312 KB
testcase_50 AC 2,589 ms
192,320 KB
testcase_51 AC 2,581 ms
193,828 KB
testcase_52 AC 2,550 ms
190,964 KB
testcase_53 AC 2,488 ms
194,352 KB
testcase_54 AC 2,318 ms
191,320 KB
testcase_55 AC 2,199 ms
193,152 KB
testcase_56 AC 2,109 ms
188,324 KB
testcase_57 AC 2,134 ms
189,448 KB
testcase_58 AC 2,142 ms
192,100 KB
testcase_59 AC 2,036 ms
183,880 KB
testcase_60 AC 2,178 ms
195,068 KB
testcase_61 AC 2 ms
4,384 KB
testcase_62 AC 1 ms
4,380 KB
testcase_63 AC 2,176 ms
193,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#define rep(i,n) for(ll i=0;i<n;i++)
#define repl(i,l,r) for(ll i=(l);i<(r);i++)
#define per(i,n) for(ll i=(n)-1;i>=0;i--)
#define perl(i,r,l) for(ll i=r-1;i>=l;i--)
#define fi first
#define se second
#define pb push_back
#define ins insert
#define pqueue(x) priority_queue<x,vector<x>,greater<x>>
#define all(x) (x).begin(),(x).end()
#define CST(x) cout<<fixed<<setprecision(x)
#define vtpl(x,y,z) vector<tuple<x,y,z>>
#define rev(x) reverse(x);
using ll=long long;
using vl=vector<ll>;
using vvl=vector<vector<ll>>;
using pl=pair<ll,ll>;
using vpl=vector<pl>;
using vvpl=vector<vpl>;
const ll MOD=1000000007;
const ll MOD9=998244353;
const int inf=1e9+10;
const ll INF=4e18;
const ll dy[9]={0,1,-1,0,1,1,-1,-1,0};
const ll dx[9]={1,0,0,-1,1,-1,1,-1,0};
template<class T> inline bool chmin(T& a, T b) {
    if (a > b) {
        a = b;
        return true;
    }
    return false;
}
template<class T> inline bool chmax(T& a, T b) {
    if (a < b) {
        a = b;
        return true;
    }
    return false;
}
unordered_map<ll,ll> mp;
//ll cnt=0;
ll dp(ll n,ll k){
    if(k==0)return 0;
    if(n==0)return 1;
    //cnt++;
    if(mp.count(n*inf+k))return mp[n*inf+k];
    ll ans=dp(n-1,k)+dp(n-1,k/n);
    mp[n*inf+k]=ans;
    return ans;
}
int main(){
    ll N,K;cin >> N >> K;
    cout << dp(N,K)-1 <<endl;
    //cout << cnt << endl;
}   
0