結果
問題 | No.473 和と積の和 |
ユーザー | 👑 kmjp |
提出日時 | 2016-12-23 00:23:53 |
言語 | C++11 (gcc 11.4.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,291 bytes |
コンパイル時間 | 1,710 ms |
コンパイル使用メモリ | 178,228 KB |
実行使用メモリ | 25,440 KB |
最終ジャッジ日時 | 2024-05-09 13:13:25 |
合計ジャッジ時間 | 10,085 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 5 ms
10,616 KB |
testcase_01 | AC | 4 ms
10,480 KB |
testcase_02 | AC | 4 ms
10,492 KB |
testcase_03 | TLE | - |
testcase_04 | AC | 5 ms
10,440 KB |
testcase_05 | AC | 4 ms
10,432 KB |
testcase_06 | AC | 5 ms
10,428 KB |
testcase_07 | AC | 5 ms
10,284 KB |
testcase_08 | AC | 5 ms
10,512 KB |
testcase_09 | AC | 4 ms
10,496 KB |
testcase_10 | AC | 5 ms
10,284 KB |
testcase_11 | AC | 4 ms
10,416 KB |
testcase_12 | AC | 5 ms
10,432 KB |
testcase_13 | AC | 4 ms
10,328 KB |
testcase_14 | AC | 5 ms
10,436 KB |
testcase_15 | AC | 5 ms
10,504 KB |
testcase_16 | AC | 4 ms
10,472 KB |
testcase_17 | AC | 5 ms
10,476 KB |
testcase_18 | AC | 4 ms
10,444 KB |
testcase_19 | AC | 5 ms
10,500 KB |
testcase_20 | AC | 6 ms
10,500 KB |
testcase_21 | AC | 4 ms
10,484 KB |
testcase_22 | AC | 4 ms
10,400 KB |
testcase_23 | AC | 14 ms
10,744 KB |
testcase_24 | AC | 23 ms
10,864 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 | -- | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #undef _P #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) //------------------------------------------------------- ll N,X; vector<ll> V; unordered_map<ll,int> R; map<ll,int> memo[101][1500]; ll dfs(int left,int id,ll v) { if(left==0) return v==X; if(memo[left][id].count(v)) return memo[left][id][v]; ll ret=0; int x; for(x=id;x<V.size();x++) if(R.count(v*V[x])) ret += dfs(left-1,x,v*V[x]); return memo[left][id][v]=ret; } vector<ll> enumdiv(ll n) { vector<ll> S; for(ll i=1;i*i<=n;i++) if(n%i==0) {S.push_back(i); if(i*i!=n) S.push_back(n/i); } sort(S.begin(),S.end()); return S; } void solve() { int i,j,k,l,r,x,y; string s; cin>>N>>X; X++; V=enumdiv(X); FOR(i,V.size()) R[V[i]]=i; cout<<dfs(N,1,1)<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); solve(); return 0; }