結果

問題 No.1532 Different Products
ユーザー kotatsugamekotatsugame
提出日時 2021-06-04 20:28:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 642 bytes
コンパイル時間 719 ms
コンパイル使用メモリ 75,908 KB
実行使用メモリ 17,104 KB
最終ジャッジ日時 2024-04-29 23:51:40
合計ジャッジ時間 8,519 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 874 ms
7,496 KB
testcase_02 AC 16 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 19 ms
5,376 KB
testcase_08 AC 75 ms
5,376 KB
testcase_09 AC 138 ms
7,504 KB
testcase_10 AC 604 ms
11,592 KB
testcase_11 AC 358 ms
11,596 KB
testcase_12 TLE -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:19:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   19 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
int N;
long K;
const int LIM=20;
long ans;
vector<long>P;
void f(long k,int n)
{
	if(k==0)return;
	ans+=upper_bound(P.begin(),P.end(),k)-P.begin();
	for(int m=min((long)n,k);m>LIM;m--)
	{
		f(k/m,m-1);
	}
}
main()
{
	cin>>N>>K;
	if(N<=LIM)
	{
		for(int i=1;i<1<<N;i++)
		{
			long t=1;
			for(int j=0;t<=K&&j<N;j++)if(i>>j&1)t*=j+1;
			if(t<=K)ans++;
		}
		cout<<ans<<endl;
		return 0;
	}
	for(int i=0;i<1<<LIM;i++)
	{
		long t=1;
		for(int j=0;t<=K&&j<LIM;j++)if(i>>j&1)t*=j+1;
		if(t<=K)P.push_back(t);
	}
	sort(P.begin(),P.end());
	f(K,N);
	cout<<ans-1<<endl;
}
0