Submission #444102

#TimeUsernameProblemLanguageResultExecution timeMemory
444102Haruto810198Toys (CEOI18_toy)C++17
100 / 100
2683 ms86568 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define double long double #define FOR(i, l, r, d) for(int i=(l); i<=(r); i+=(d)) #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 eb emplace_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(){ ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); 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(i, 1, C-1, 1){ FOR(j, 0, i-1, 1){ 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...