結果
| 問題 |
No.473 和と積の和
|
| コンテスト | |
| ユーザー |
tails
|
| 提出日時 | 2016-12-23 03:22:33 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 666 bytes |
| コンパイル時間 | 1,958 ms |
| コンパイル使用メモリ | 179,768 KB |
| 実行使用メモリ | 531,584 KB |
| 最終ジャッジ日時 | 2024-12-16 03:03:14 |
| 合計ジャッジ時間 | 33,223 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 MLE * 2 |
| other | AC * 37 TLE * 6 |
コンパイルメッセージ
main.cpp:4:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
4 | main(){
| ^~~~
ソースコード
#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);
}
tails