結果

問題 No.1532 Different Products
ユーザー fumofumofunifumofumofuni
提出日時 2022-01-17 16:43:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 3,174 ms / 4,000 ms
コード長 1,337 bytes
コンパイル時間 2,288 ms
コンパイル使用メモリ 208,188 KB
実行使用メモリ 199,832 KB
最終ジャッジ日時 2023-12-23 10:50:45
合計ジャッジ時間 106,295 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 393 ms
39,848 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 72 ms
13,312 KB
testcase_10 AC 523 ms
46,924 KB
testcase_11 AC 351 ms
35,780 KB
testcase_12 AC 1,563 ms
110,296 KB
testcase_13 AC 642 ms
53,900 KB
testcase_14 AC 2,505 ms
164,880 KB
testcase_15 AC 8 ms
6,676 KB
testcase_16 AC 458 ms
45,156 KB
testcase_17 AC 343 ms
35,072 KB
testcase_18 AC 214 ms
25,320 KB
testcase_19 AC 1,548 ms
107,216 KB
testcase_20 AC 2,551 ms
167,836 KB
testcase_21 AC 702 ms
61,360 KB
testcase_22 AC 803 ms
64,232 KB
testcase_23 AC 310 ms
31,700 KB
testcase_24 AC 2,367 ms
156,704 KB
testcase_25 AC 1,224 ms
94,576 KB
testcase_26 AC 80 ms
14,848 KB
testcase_27 AC 997 ms
80,128 KB
testcase_28 AC 772 ms
63,284 KB
testcase_29 AC 732 ms
61,888 KB
testcase_30 AC 1,501 ms
106,768 KB
testcase_31 AC 1,443 ms
107,508 KB
testcase_32 AC 1,756 ms
122,204 KB
testcase_33 AC 1,278 ms
96,096 KB
testcase_34 AC 2,205 ms
145,924 KB
testcase_35 AC 1,714 ms
121,268 KB
testcase_36 AC 2,154 ms
143,708 KB
testcase_37 AC 444 ms
43,264 KB
testcase_38 AC 2,287 ms
151,964 KB
testcase_39 AC 1,988 ms
136,940 KB
testcase_40 AC 2,085 ms
139,624 KB
testcase_41 AC 2,982 ms
191,008 KB
testcase_42 AC 2,664 ms
171,872 KB
testcase_43 AC 2,794 ms
179,044 KB
testcase_44 AC 3,083 ms
195,732 KB
testcase_45 AC 3,020 ms
196,788 KB
testcase_46 AC 2,958 ms
188,580 KB
testcase_47 AC 3,174 ms
198,940 KB
testcase_48 AC 3,091 ms
196,592 KB
testcase_49 AC 3,065 ms
197,244 KB
testcase_50 AC 3,057 ms
195,660 KB
testcase_51 AC 3,121 ms
198,652 KB
testcase_52 AC 3,016 ms
193,160 KB
testcase_53 AC 3,090 ms
198,992 KB
testcase_54 AC 2,996 ms
193,152 KB
testcase_55 AC 2,984 ms
197,160 KB
testcase_56 AC 2,881 ms
188,504 KB
testcase_57 AC 2,949 ms
189,976 KB
testcase_58 AC 3,008 ms
195,116 KB
testcase_59 AC 2,827 ms
183,260 KB
testcase_60 AC 3,127 ms
199,832 KB
testcase_61 AC 2 ms
6,676 KB
testcase_62 AC 2 ms
6,676 KB
testcase_63 AC 3,075 ms
196,892 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> memo[210];
ll dp(ll n,ll k){
    if(k==0)return 0;
    if(n==0)return 1;
    if(memo[n].count(k))return memo[n][k];
    ll ans=dp(n-1,k)+dp(n-1,k/n);
    memo[n][k]=ans;
    return ans;
}
int main(){
    ll N,K;cin >> N >> K;
    cout << dp(N,K)-1 <<endl;
}   
0