# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
942767 | vjudge1 | Toys (CEOI18_toy) | C++17 | 1 ms | 600 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;v.pb(0);
for(int i=2;i*i<=n;i++){
while(n%i==0){
v.pb(i);
n/=i;
}
}
if(n>1)v.pb(n);
vector <int> sum[v.size()];
sum[0].pb(0);
for(int i=1;i<v.size();i++){
int x=v[i];
for(int j=i-1;j>=0;j--){
for(auto val : sum[j])sum[i].pb(x-1+val);
x*=v[j];
}
}
sort(all(sum[v.size()-1]));
int p=-1;
vector <int> res;
for(auto x : sum[v.size()-1]){
if(x!=p)res.pb(x);
p=x;
}
cout<<res.size()<<"\n";
for(auto x : res)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... |