結果

問題 No.473 和と積の和
ユーザー tailstails
提出日時 2016-12-23 03:22:33
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 666 bytes
コンパイル時間 1,700 ms
コンパイル使用メモリ 181,280 KB
実行使用メモリ 500,384 KB
最終ジャッジ日時 2024-05-09 13:25:39
合計ジャッジ時間 7,641 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 1,093 ms
160,256 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 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 1 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
testcase_15 AC 1 ms
5,376 KB
testcase_16 AC 2 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
testcase_20 AC 2 ms
5,376 KB
testcase_21 AC 2 ms
5,376 KB
testcase_22 AC 2 ms
5,376 KB
testcase_23 AC 5 ms
5,376 KB
testcase_24 AC 14 ms
5,632 KB
testcase_25 TLE -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

main(){
	int n,x;
	scanf("%d%d",&n,&x);
	++x;
	vector<int> v;
	for(int i=2;i*i<=x;){
		if(x%i==0){
			v.push_back(i);
			x/=i;
		}else{
			++i;
		}
	}
	v.push_back(x);
	int r=0;
	if(v.size()>=n){
		multiset<int> m;
		for(int i=0;i<n;++i){
			m.insert(1);
		}
		set<multiset<int>> s1,s2;
		s1.insert(m);
		for(int i=0;i<v.size();++i){
			for(multiset<int> const& m1:s1){
				for(int a:m1){
					multiset<int> m2=m1;
					m2.erase(m2.find(a));
					m2.insert(a*v[i]);
					s2.insert(m2);
				}
			}
			s1.swap(s2);s2.clear();
		}
		for(multiset<int> const& m1:s1){
			r+=m1.find(1)==m1.end();
		}
	}
	printf("%d\n",r);
}
0