# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145862 | nvmdava | Toys (CEOI18_toy) | C++17 | 3828 ms | 86752 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;
#define ff first
#define ss second
#define ll long long
map<int, set<int> > res;
vector<int> divis;
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int n;
cin>>n;
for(int i = 1; i * i <= n; i++){
if(n % i == 0){
divis.push_back(i);
if(i * i != n)
divis.push_back(n / i);
}
}
divis.push_back(n);
sort(divis.begin(), divis.end());
res[1].insert(0);
for(int i = 1; i < divis.size(); i++){
int d = divis[i];
auto& it = res[d];
for(int j = 0; j <= i; j++){
if(d % divis[j] == 0){
for(auto& x : res[divis[j]]){
it.insert(x + d / divis[j] - 1);
}
}
}
}
cout<<res[n].size()<<'\n';
for(auto& x : res[n]){
cout<<x<<' ';
}
}
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... |