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 <iostream>
#include <vector>
#include <set>
#include <algorithm>
using namespace std;
#define sz(x) (int(x.size()))
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n;
cin >> n;
vector<int> res[1+n];
for(int i = 1; i <= n; i++)
{
res[i].push_back(i-1);
for(int j = 1; j < i; j++)
{
if(i % j == 0)
{
int u = j;
int v = i/j;
for(int a: res[u])
for(int b: res[v])
res[i].push_back(a+b);
// break;
}
}
sort(res[i].begin(), res[i].end());
res[i].erase(unique(res[i].begin(), res[i].end()), res[i].end());
}
cout << sz(res[n]) << '\n';
for(int r: res[n]) cout << r << ' ';
cout << '\n';
}
# | 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... |