Submission #920781

#TimeUsernameProblemLanguageResultExecution timeMemory
920781Jawad_Akbar_JJToys (CEOI18_toy)C++17
79 / 100
5018 ms66732 KiB
#pragma GCC optimize("O2") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <iostream> #include <vector> #include <algorithm> #include <map> #include <set> using namespace std; map<int,int> num; signed main(){ int n; cin>>n; vector<int> d; for (int i=1;i * i<=n;i++){ if (n % i == 0){ d.push_back(i); d.push_back(n / i); } } sort(begin(d),end(d)); set<int> S[d.size() + 100]; vector<int> vec[d.size() + 100]; S[0].insert(0); vec[0].push_back(0); int k = d.size(); for (int i=0;i<k;i++) num[d[i]] = i+1; for (int i=1;i<k;i++){ S[i].insert(d[i]-1); for (int j : S[i]) vec[i].push_back(j); for (int j=0;j<=i;j++){ if (num[d[i] * d[j]] == 0) continue; for (int l : vec[j]) for (int m : vec[i]) S[num[d[i] * d[j]] - 1].insert(m + l); } } cout<<S[k-1].size()<<'\n'; for (int i : S[k-1]) printf("%d ",i); printf("\n"); }
#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...