結果

問題 No.473 和と積の和
コンテスト
ユーザー 👑 tails
提出日時 2016-12-23 00:39:54
言語 C++14
(gcc 15.2.0 + boost 1.89.0)
コンパイル:
g++-15 -O2 -lm -std=c++14 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
TLE  
実行時間 -
コード長 522 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,084 ms
コンパイル使用メモリ 191,056 KB
実行使用メモリ 102,528 KB
最終ジャッジ日時 2026-05-26 08:47:08
合計ジャッジ時間 8,511 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 21 TLE * 1 -- * 21
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
    4 | main(){
      | ^~~~

ソースコード

diff #
raw source code

#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