Submission #93395

#TimeUsernameProblemLanguageResultExecution timeMemory
93395KastandaToys (CEOI18_toy)C++11
100 / 100
2891 ms91288 KiB
#include<bits/stdc++.h> #define pb push_back using namespace std; const int N = 100005; int n; vector < int > D; set < int > M[N]; int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n; for (int i = 1; i * i <= n; i++) if (n % i == 0) D.pb(i), D.pb(n / i); sort(D.begin(), D.end()); D.resize(unique(D.begin(), D.end()) - D.begin()); M[0].insert(0); for (int i = 1; i < D.size(); i++) for (int j = 0; j < i; j++) if (D[i] % D[j] == 0) { int d = D[i] / D[j] - 1; for (int a : M[j]) M[i].insert(a + d); } int last = (int)D.size() - 1; cout << (int)M[last].size() << "\n"; for (int a : M[last]) cout << a << " "; return (0); }

Compilation message (stderr)

toy.cpp: In function 'int main()':
toy.cpp:19:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i = 1; i < D.size(); i++)
                     ~~^~~~~~~~~~
#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...