Submission #112394

#TimeUsernameProblemLanguageResultExecution timeMemory
112394redaToys (CEOI18_toy)C++14
0 / 100
7 ms5120 KiB
#include <bits/stdc++.h> #define MAXN 100005 using namespace std; set<int> dp[MAXN]; set<int> summerg(set<int> S,set<int> T) { set<int> ans; for(auto a : S) for(auto b : T) ans.insert(a+b); return ans; } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n; cin >> n; for(int i = 2; i <= n; i++) { for(int j = 2; j*j <= i; j++) { if(i % j == 0) { auto x = summerg(dp[j],dp[i / j]); dp[i].insert(x.begin(),x.end()); } } dp[i].insert(i-1); } cout<<dp[n].size()<<endl; for(auto x:dp[n]) cout<<x<< ' '; 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...