結果

問題 No.473 和と積の和
ユーザー tailstails
提出日時 2016-12-23 00:39:54
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
TLE  
実行時間 -
コード長 522 bytes
コンパイル時間 1,976 ms
コンパイル使用メモリ 178,280 KB
実行使用メモリ 175,520 KB
最終ジャッジ日時 2024-12-16 02:55:02
合計ジャッジ時間 41,184 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 TLE * 1
other AC * 35 TLE * 8
権限があれば一括ダウンロードができます
コンパイルメッセージ
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);
	set<multiset<int>> s1;
	set<multiset<int>> s2;
	{
		multiset<int> m;
		m.insert(x);
		s1.insert(m);
	}
	for(int i=1;i<n;++i){
		for(multiset<int> const& m:s1){
			for(int v:m){
				for(int j=2;j*j<=v+1;++j){
					if((v+1)%j==0){
						multiset<int> m2=m;
						m2.erase(m2.find(v));
						m2.insert(j-1);
						m2.insert((v+1)/j-1);
						s2.insert(m2);
					}
				}
			}
		}
		s1.swap(s2);s2.clear();
	}
	printf("%d\n",s1.size());
}
0