# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
523588 | Deepesson | Toys (CEOI18_toy) | C++17 | 5058 ms | 464 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>
std::vector<long long> divisores;
std::map<int,bool> respostas;
std::map<std::vector<long long>,bool> foi;
void processa(std::vector<long long> tem){
if(foi[tem])return;
{
int s=0;
for(auto&x:tem)s+=x-1;
respostas[s]=true;
}
for(int i=0;i!=tem.size();++i){
for(int j = i+1;j<tem.size();++j){
std::vector<long long> prox;
prox.push_back(tem[i]*tem[j]);
for(int k=0;k!=tem.size();++k){
if(k==i||k==j)continue;
prox.push_back(tem[k]);
}
std::sort(prox.begin(),prox.end());
processa(prox);
}
}
}
void achar_divisores(long long x){
for(int i=2;i!=1000000;++i){
if(!(x%i)){
while(!(x%i)){
divisores.push_back(i);
x/=i;
}
}
}
if(x>1)divisores.push_back(x);
}
int main()
{
long long N;
std::cin>>N;
achar_divisores(N);
processa(divisores);
std::cout<<respostas.size()<<"\n";
for(auto&x:respostas)std::cout<<x.first<<" ";
std::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... |