# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
585008 | krit3379 | Toys (CEOI18_toy) | C++17 | 2276 ms | 86536 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;
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#define N 100005
map<int,set<int>> mp;
void sol(int n){
if(mp.count(n))return ;
int i,sq=sqrt(n);
for(i=1;i<=sq;i++){
if(n%i==0){
sol(i);
for(auto x:mp[i])mp[n].insert(n/i-1+x);
if(i!=1){
sol(n/i);
for(auto x:mp[n/i])mp[n].insert(i-1+x);
}
}
}
}
int main(){
int n,i,sum;
scanf("%d",&n);
mp[1].insert(0);
sol(n);
printf("%d\n",mp[n].size());
for(auto x:mp[n])printf("%d ",x);
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... |