# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1070386 | YassirSalama | Toys (CEOI18_toy) | C++17 | 1129 ms | 262144 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 pb push_back
template<typename T>
void dbg(const T& t){
cout<<t<<"\n";
}
template<typename T,typename... Args>
void dbg(const T& t,const Args&... args){
cout<<t<<" , ";
dbg(args...);
}
#define dbg(...) cout<<"("<<#__VA_ARGS__<<") : ";dbg(__VA_ARGS__);
#define all(v) v.begin(),v.end()
set<vector<int>> decomp;
set<vector<int>> c;
signed main(){
int n;
cin>>n;
int x=n;
vector<int> p;
for(int i=2;;i++){
if(i*i>x) break;
while(n%i==0){
p.pb(i);
n/=i;
}
}
if(n!=1) p.pb(n);
sort(all(p));
decomp.insert({1});
for(auto &pp : p){
c.clear();
for(auto &x:decomp){
for(int i=0;i<x.size();i++){
vector<int> t=x;
t[i]*=pp;
sort(all(t));
c.insert(t);
}
vector<int> t=x;
t.pb(pp);
if(t.size()>28) continue;
sort(all(t));
c.insert(t);
}
decomp=c;
}
vector<int> ans;
for(auto x:decomp){
long long s=0;
for(auto y:x){
s+=y-1;
}
ans.pb(s);
}
sort(all(ans));
ans.erase(unique(all(ans)),ans.end());
cout<<ans.size()<<"\n";
for(auto x:ans){
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... |