# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
217927 | DystoriaX | Toys (CEOI18_toy) | C++14 | 2943 ms | 86904 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;
int n;
vector<int> factor;
vector<set<int> > v;
int main(){
scanf("%d", &n);
for(int i = 1; i * i <= n; i++){
if(n % i == 0){
factor.emplace_back(i);
if(i * i != n) factor.emplace_back(n / i);
}
}
sort(factor.begin(), factor.end());
v.resize(factor.size());
for(int i = 0; i < (int) factor.size(); i++) v[i].insert(factor[i] - 1);
for(int i = 0; i < (int) factor.size(); i++){
for(int j = 0; j < i; j++){
if(factor[i] % factor[j] == 0){
for(auto &k : v[j])
v[i].insert(k + (factor[i] / factor[j]) - 1);
}
}
}
printf("%d\n", (int) v.back().size());
for(auto k : v.back()) printf("%d ", k);
printf("\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... |