結果
| 問題 |
No.473 和と積の和
|
| コンテスト | |
| ユーザー |
rickytheta
|
| 提出日時 | 2016-12-23 00:21:04 |
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,539 bytes |
| コンパイル時間 | 1,901 ms |
| コンパイル使用メモリ | 173,324 KB |
| 実行使用メモリ | 303,008 KB |
| 最終ジャッジ日時 | 2024-12-16 02:36:41 |
| 合計ジャッジ時間 | 27,648 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 39 TLE * 4 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef pair<int,int> pii;
typedef pair<ll,ll> pll;
typedef int _loop_int;
#define REP(i,n) for(_loop_int i=0;i<(_loop_int)(n);++i)
#define FOR(i,a,b) for(_loop_int i=(_loop_int)(a);i<(_loop_int)(b);++i)
#define FORR(i,a,b) for(_loop_int i=(_loop_int)(b)-1;i>=(_loop_int)(a);--i)
#define DEBUG(x) cout<<#x<<": "<<x<<endl
#define DEBUG_VEC(v) cout<<#v<<":";REP(i,v.size())cout<<" "<<v[i];cout<<endl
#define ALL(a) (a).begin(),(a).end()
#define CHMIN(a,b) a=min((a),(b))
#define CHMAX(a,b) a=max((a),(b))
// mod
const ll MOD = 1000000007ll;
#define FIX(a) ((a)%MOD+MOD)%MOD
// floating
typedef double Real;
const Real EPS = 1e-11;
#define EQ0(x) (abs(x)<EPS)
#define EQ(a,b) (abs(a-b)<EPS)
typedef complex<Real> P;
//
int dp[125][35];
int main(){
int n;
int x;
cin>>n>>x;
x++;
// factorize x with n numbers
set<vi> S;
S.insert(vi(n,1));
for(int p=2;p*p<=x;p++){
while(x%p==0){
x/=p;
set<vi> nxt;
for(const vi &X : S){
REP(i,n){
vi add = X;
add[i] *= p;
sort(ALL(add));
nxt.insert(add);
}
}
swap(S,nxt);
}
}
if(x!=1){
set<vi> nxt;
for(const vi &X : S){
REP(i,n){
vi add = X;
add[i] *= x;
sort(ALL(add));
nxt.insert(add);
}
}
swap(S,nxt);
}
int ans = 0;
for(const vi &X : S){
if(X[0]!=1)ans++;
}
printf("%d\n",ans);
return 0;
}
rickytheta