This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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 time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |