結果

問題 No.1532 Different Products
ユーザー V_MelvilleV_Melville
提出日時 2021-06-26 18:04:09
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 964 bytes
コンパイル時間 2,095 ms
コンパイル使用メモリ 205,540 KB
実行使用メモリ 207,276 KB
最終ジャッジ日時 2023-09-07 15:24:34
合計ジャッジ時間 26,107 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 100 ms
167,960 KB
testcase_02 AC 39 ms
163,704 KB
testcase_03 AC 38 ms
163,716 KB
testcase_04 AC 39 ms
163,764 KB
testcase_05 AC 39 ms
163,648 KB
testcase_06 AC 39 ms
163,704 KB
testcase_07 AC 45 ms
163,776 KB
testcase_08 AC 40 ms
163,656 KB
testcase_09 AC 49 ms
164,120 KB
testcase_10 AC 98 ms
166,436 KB
testcase_11 AC 79 ms
165,700 KB
testcase_12 AC 220 ms
175,576 KB
testcase_13 AC 124 ms
169,444 KB
testcase_14 AC 522 ms
203,248 KB
testcase_15 AC 39 ms
163,716 KB
testcase_16 AC 99 ms
167,944 KB
testcase_17 AC 79 ms
165,828 KB
testcase_18 AC 65 ms
165,740 KB
testcase_19 AC 206 ms
174,236 KB
testcase_20 AC 496 ms
202,376 KB
testcase_21 AC 141 ms
172,552 KB
testcase_22 AC 133 ms
168,780 KB
testcase_23 AC 79 ms
167,880 KB
testcase_24 AC 443 ms
202,300 KB
testcase_25 AC 200 ms
176,332 KB
testcase_26 AC 51 ms
164,220 KB
testcase_27 AC 214 ms
176,496 KB
testcase_28 AC 159 ms
173,956 KB
testcase_29 AC 108 ms
166,428 KB
testcase_30 AC 285 ms
187,116 KB
testcase_31 AC 289 ms
188,592 KB
testcase_32 AC 390 ms
202,292 KB
testcase_33 AC 265 ms
184,696 KB
testcase_34 AC 442 ms
202,340 KB
testcase_35 AC 424 ms
202,436 KB
testcase_36 AC 470 ms
202,828 KB
testcase_37 AC 77 ms
164,404 KB
testcase_38 AC 473 ms
202,340 KB
testcase_39 AC 433 ms
202,420 KB
testcase_40 AC 429 ms
202,364 KB
testcase_41 AC 564 ms
205,236 KB
testcase_42 AC 514 ms
203,052 KB
testcase_43 AC 530 ms
203,616 KB
testcase_44 AC 587 ms
206,668 KB
testcase_45 AC 593 ms
207,004 KB
testcase_46 AC 559 ms
206,468 KB
testcase_47 AC 575 ms
206,884 KB
testcase_48 AC 567 ms
206,692 KB
testcase_49 AC 564 ms
206,872 KB
testcase_50 AC 580 ms
206,680 KB
testcase_51 AC 570 ms
206,944 KB
testcase_52 AC 605 ms
206,688 KB
testcase_53 AC 616 ms
207,012 KB
testcase_54 AC 613 ms
206,680 KB
testcase_55 AC 618 ms
206,884 KB
testcase_56 AC 548 ms
206,156 KB
testcase_57 AC 551 ms
206,484 KB
testcase_58 AC 585 ms
206,744 KB
testcase_59 AC 560 ms
205,552 KB
testcase_60 AC 594 ms
207,276 KB
testcase_61 AC 38 ms
163,700 KB
testcase_62 AC 38 ms
163,972 KB
testcase_63 AC 572 ms
206,992 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e11;
const int N=205,M=1e5+5;
ll n,k,fac[N],two[N],ans;
unordered_map<ll,ll>dp2;
ll dp[N][M];
ll dfs(ll x,ll now){
	if(!x)return 1;
	if(now>=M){
		ll hash=x*INF+now;
		if(dp2.count(hash)){
			return dp2[hash];
		}
		if(now>=fac[x]){
			return two[x];
		}
		ll ans=0;
		ans=(ans+dfs(x-1,now));
		ans=(ans+dfs(min(now/x,x-1),now/x));
		return dp2[hash]=ans;
	}
	else{
		if(~dp[x][now]){
			return dp[x][now];
		}	
		ll ans=0;
		ans=(ans+dfs(x-1,now));
		ans=(ans+dfs(min(now/x,x-1),now/x));
		return dp[x][now]=ans;
	}
}
int main(){
	scanf("%lld%lld",&n,&k);
	memset(dp,-1,sizeof dp);
	fac[0]=two[0]=1;
	for(int i=1;i<=40;++i){
		two[i]=2ll*two[i-1];
	}
	for(int i=1;i<=n;++i){ 
		fac[i]=1ll*fac[i-1]*i;
		fac[i]=min(fac[i],INF);
	}
	for(int i=1;i<=min(n,k);++i){
		ans+=dfs(i-1,k/i);
	}
	printf("%lld\n",ans);
	return 0; 
}
/*
100 1000000000
1480348241
200 10000000000
44692356573
*/ 
0