# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
367909 | ogibogi2004 | Toys (CEOI18_toy) | C++14 | 2297 ms | 85764 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 ll long long
ll n;
unordered_set<int>v[100000];
int main()
{
cin>>n;
vector<ll>d;
for(ll i=1;i*i<=n;i++)
{
if(n%i==0)
{
d.push_back(i);
if(i*i!=n)
{
d.push_back(n/i);
}
}
}
sort(d.begin(),d.end());
v[0].insert(0);
for(int i=0;i<d.size();i++)
{
for(int j=i+1;j<d.size();j++)
{
if(d[j]%d[i]!=0)continue;
for(auto xd:v[i])
{
v[j].insert(xd+d[j]/d[i]-1);
}
}
}
vector<int>ans;
for(auto xd:v[d.size()-1])
{
ans.push_back(xd);
}
sort(ans.begin(),ans.end());
cout<<ans.size()<<endl;
for(auto xd:ans)
{
cout<<xd<<" ";
}
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... |