Submission #975330

#TimeUsernameProblemLanguageResultExecution timeMemory
975330IBoryToys (CEOI18_toy)C++17
79 / 100
5034 ms117432 KiB
#include <bits/stdc++.h> #include <unordered_set> using namespace std; const int MAX = 222222; vector<int> D; unordered_set<int> S[MAX]; int main() { int N; cin >> N; for (int i = 1; i * i <= N; ++i) { D.push_back(i); if (i * i != N) D.push_back(N / i); } sort(D.begin(), D.end()); S[0].insert(0); for (int i = 0; i < D.size(); ++i) { // sort(S[i].begin(), S[i].end()); // S[i].erase(unique(S[i].begin(), S[i].end()), S[i].end()); for (int j = i + 1; j < D.size(); ++j) { if (D[j] % D[i]) continue; for (int n : S[i]) S[j].insert(n + D[j] / D[i] - 1); } } vector<int> ans; for (int n : S[D.size() - 1]) ans.push_back(n); sort(ans.begin(), ans.end()); cout << ans.size() << '\n'; for (int n : ans) cout << n << ' '; return 0; cout << S[D.size() - 1].size() << '\n'; for (int n : S[D.size() - 1]) cout << n << ' '; return 0; }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for (int i = 0; i < D.size(); ++i) {
      |                  ~~^~~~~~~~~~
toy.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for (int j = i + 1; j < D.size(); ++j) {
      |                       ~~^~~~~~~~~~
#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...