# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1103935 | ezzzay | Toys (CEOI18_toy) | C++14 | 1534 ms | 4424 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 int long long
#define ff first
#define ss second
#define pb push_back
int m,n;
vector<int>vc;
set<int>st;
void fun(int x, int p, int k){
if(x==1){
st.insert(k);
return;
}
for(int i=p;i<vc.size();i++){
if(vc[i]>x)break;
if(x%vc[i]==0){
fun(x/vc[i],i,k+vc[i]-1);
}
}
}
signed main(){
cin>>n;
set<int>ts;
for(int i=2;i<=sqrt(n);i++){
if(n%i==0){
ts.insert(i);
ts.insert(n/i);
}
}
for(auto a:ts)vc.pb(a);
fun(n,0,0);
st.insert(n-1);
cout<<st.size()<<endl;
for(auto a:st)cout<<a<<" ";
}
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... |