Submission #920777

#TimeUsernameProblemLanguageResultExecution timeMemory
920777Jawad_Akbar_JJToys (CEOI18_toy)C++17
59 / 100
5114 ms224512 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; 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)); int k = d.size(); set<pair<int,int>> P; set<int> s; P.insert({0,1}); for (int i=1;i<k;i++){ for (auto [l,j] : P){ if (1LL * j * d[i] > 1LL * n) continue; P.insert({l + d[i] - 1,j * d[i]}); if (1LL * j * d[i] == 1LL * n) s.insert(l + d[i] - 1); } } printf("%d\n",(int)s.size()); for (int i : s) 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...