Submission #468110

#TimeUsernameProblemLanguageResultExecution timeMemory
468110ivan_tudorToys (CEOI18_toy)C++14
100 / 100
2809 ms86724 KiB
#include<bits/stdc++.h> using namespace std; map<int, set<int>> mp; void getnr(int x){ if(mp.count(x)) return; mp[x] = set<int>(); for(int d = 2; d*d <= x; d++){ if(x%d == 0){ getnr(x/d); for(auto nr:mp[x/d]) mp[x].insert(nr + d - 1); getnr(d); for(auto nr:mp[d]) mp[x].insert(nr + x/d - 1); } } mp[x].insert(x - 1); } int main() { //freopen(".in","r",stdin); ios::sync_with_stdio(false); cin.tie(0),cout.tie(0); int n; cin>>n; getnr(n); cout<<mp[n].size()<<"\n"; for(auto x:mp[n]) cout<<x<<" "; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...