# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
943377 | vjudge1 | Toys (CEOI18_toy) | C++17 | 2664 ms | 90180 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>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
signed main(){
ios_base::sync_with_stdio();
cin.tie(0);cout.tie(0);
int n;
cin>>n;
vector <int> v;
for(int i=1;i*i<=n;i++){
if(n%i==0){
v.pb(i);
if(i!=n/i)v.pb(n/i);
}
}
sort(all(v));
set <int> res;
map <int,set <int> > sum;
sum[1].insert(0);
for(int i=0;i<v.size();i++){
for(int j=0;j<i;j++){
if(v[i]%v[j]==0){
for(auto x : sum[v[j]])sum[v[i]].insert(x+v[i]/v[j]-1);
}
}
}
for(auto x : sum[n])res.insert(x);
cout<<res.size()<<"\n";
for(auto x : res)cout<<x<<" ";
cout<<"\n";
}
/*
*/
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... |