Submission #464296

#TimeUsernameProblemLanguageResultExecution timeMemory
464296osmanallazovToys (CEOI18_toy)C++14
0 / 100
0 ms204 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define szof(x) ((int)(x).size()) #define vi vector<int> #define pii pair<int, int> #define F first #define S second #define pb push_back #define mkp make_pair const int INF = 2147483647; const int LNF = INF*INF; const int MOD = 1000000007; const int mod = 998244353; int n; vi dv; vector<set<int>> dp; signed main(){ cin>>n; for(int i=1; i*i<=n; i++){ if(n % i == 0){ dv.pb(i); if(i * i < n) dv.pb(n / i); } } sort(dv.begin(), dv.end()); int C =szof(dv); dp.resize(C); dp[0].insert(0); for(int i=1;i<C-1;i++){ for(int j=0;j<i-1;j++){ if(dv[i] % dv[j] != 0) continue; int mt = dv[i] / dv[j]; for(int k : dp[j]){ dp[i].insert(k + mt - 1); } } } cout<<szof(dp[C-1])<<'\n'; for(int i : dp[C-1]){ cout<<i<<" "; } cout<<'\n'; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...