# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581704 | Memito08 | Toys (CEOI18_toy) | C++14 | 0 ms | 212 KiB |
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>
using namespace std;
vector<int> sumas;
long long sum = 0;
vector<bool> u;
void solve(long long n, int act) {
if (n == 1 && !u[sum]) {
sumas.push_back(sum);
u[sum] = 1;
return;
}
for (int i = act ; i*i <= n ; i++) {
if (n % i == 0) {
sum += i-1;
solve(n/i,i);
sum -= i-1;
}
}
if (n > 1) {
sum += n-1;
solve(1,n);
sum -= n-1;
}
}
int main() {
long long n;
cin >> n;
u.assign(n, 0);
solve(n, 2);
sort(sumas.begin(),sumas.end());
for (int i = 0 ; i < sumas.size() ; i++) {
cout << sumas[i];
if (i != sumas.size()-1) cout << " ";
}
cout << "\n";
return 0;
}
Compilation message (stderr)
# | 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... |