# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225918 | kshitij_sodani | Toys (CEOI18_toy) | C++17 | 2829 ms | 91384 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 <iostream>
#include <bits/stdc++.h>
#include <cstdio>
using namespace std;
#define pb push_back
#define a first
#define b second
typedef long long llo;
set<llo> fin;
set<llo> fac2[100000];
/*llo rec(llo nn,llo su=0,llo ma=0){
if(kk[{nn,su}]==0){
kk[{nn,su}]=1;
if(nn==1){
fin.insert(su);
}
else{
for(llo kk=fac2[ss[nn]].size()-1;kk>=0;kk--){
llo jj=fac2[ss[nn]][kk];
if(jj==1){
continue;
}
rec(nn/jj,su+jj-1);
}
}
}
}*/
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
llo n;
cin>>n;
vector<llo> fac;
fac.clear();
llo i=1;
while(i*i<=n){
if(n%i==0){
fac.pb(i);
if(i*i<n){
fac.pb(n/i);
}
// cout<<n<<" "<<i<<endl;
}
i+=1;
}
llo k=-1;
sort(fac.begin(),fac.end());
//n^(2/3) finding factors
fac2[0].insert(0);
for(llo kk=0;kk<fac.size();kk++){
for(llo ll=0;ll<kk;ll++){
if(fac[kk]%fac[ll]>0){
continue;
}
llo add=fac[kk]/fac[ll]-1;
for(auto jj:fac2[ll]){
fac2[kk].insert(jj+add);
}
}
i+=1;
}
cout<<fac2[fac.size()-1].size()<<endl;
for(auto ans2:fac2[fac.size()-1]){
cout<<ans2<<" ";
}
cout<<endl;;
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... |