Submission #217927

#TimeUsernameProblemLanguageResultExecution timeMemory
217927DystoriaXToys (CEOI18_toy)C++14
100 / 100
2943 ms86904 KiB
#include <bits/stdc++.h> using namespace std; int n; vector<int> factor; vector<set<int> > v; int main(){ scanf("%d", &n); for(int i = 1; i * i <= n; i++){ if(n % i == 0){ factor.emplace_back(i); if(i * i != n) factor.emplace_back(n / i); } } sort(factor.begin(), factor.end()); v.resize(factor.size()); for(int i = 0; i < (int) factor.size(); i++) v[i].insert(factor[i] - 1); for(int i = 0; i < (int) factor.size(); i++){ for(int j = 0; j < i; j++){ if(factor[i] % factor[j] == 0){ for(auto &k : v[j]) v[i].insert(k + (factor[i] / factor[j]) - 1); } } } printf("%d\n", (int) v.back().size()); for(auto k : v.back()) printf("%d ", k); printf("\n"); return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:10:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &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...