結果

問題 No.1532 Different Products
ユーザー V_MelvilleV_Melville
提出日時 2021-06-26 17:44:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 685 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 205,064 KB
実行使用メモリ 212,104 KB
最終ジャッジ日時 2023-09-07 15:23:21
合計ジャッジ時間 15,592 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
8,880 KB
testcase_01 AC 726 ms
46,476 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,380 KB
testcase_08 AC 3 ms
4,380 KB
testcase_09 AC 104 ms
12,392 KB
testcase_10 AC 945 ms
54,096 KB
testcase_11 AC 619 ms
38,868 KB
testcase_12 AC 2,822 ms
135,720 KB
testcase_13 AC 1,080 ms
57,424 KB
testcase_14 TLE -
testcase_15 AC 3 ms
4,380 KB
testcase_16 AC 889 ms
54,976 KB
testcase_17 AC 582 ms
37,912 KB
testcase_18 AC 306 ms
24,388 KB
testcase_19 AC 2,733 ms
130,584 KB
testcase_20 TLE -
testcase_21 AC 1,393 ms
76,056 KB
testcase_22 AC 1,455 ms
74,372 KB
testcase_23 AC 471 ms
31,668 KB
testcase_24 TLE -
testcase_25 AC 2,294 ms
115,368 KB
testcase_26 AC 150 ms
15,696 KB
testcase_27 AC 1,990 ms
102,304 KB
testcase_28 AC 1,375 ms
78,236 KB
testcase_29 AC 1,346 ms
78,956 KB
testcase_30 AC 2,794 ms
134,728 KB
testcase_31 AC 2,772 ms
135,200 KB
testcase_32 AC 3,335 ms
153,688 KB
testcase_33 AC 2,484 ms
121,684 KB
testcase_34 TLE -
testcase_35 AC 3,311 ms
152,412 KB
testcase_36 TLE -
testcase_37 AC 775 ms
56,104 KB
testcase_38 TLE -
testcase_39 AC 3,885 ms
172,816 KB
testcase_40 AC 3,965 ms
176,876 KB
testcase_41 TLE -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll INF=1e11;
ll n,k,fac[205],two[205];
map<ll,ll>dp;
ll dfs(ll x,ll now,bool hasV){
	ll hash=(x*INF+now)*2+hasV;
	if(dp.count(hash)){
		return dp[hash];
	}
	ll ans=0;
	if(now>=fac[x]){
		ans=two[x]-1+hasV;
	}
	else{
		ans=(ans+dfs(x-1,now,hasV));
		ans=(ans+dfs(min(now/x,x-1),now/x,1));
	}
	return dp[hash]=ans;
}
int main(){
	scanf("%lld%lld",&n,&k);
	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);
	}
	printf("%lld\n",dfs(min(n,k),k,0));
	return 0; 
}
/*
100 1000000000
1480348241
200 10000000000
44692356573
*/ 
0