Submission #161387

#TimeUsernameProblemLanguageResultExecution timeMemory
161387rama_pangToys (CEOI18_toy)C++14
0 / 100
2 ms252 KiB
#include <bits/stdc++.h> using namespace std; using lint = long long; vector<int> factors; set<lint> ans; void brute_force(int n, vector<lint> elements) { if (n == factors.size()) { lint res = 0; for (auto i : elements) res += i; ans.emplace(res); return; } for (auto i = 0; i < elements.size(); i++) { lint tmp = elements[i]; elements[i] = elements[i] * factors[n] + elements[i] + factors[n]; brute_force(n + 1, elements); elements[i] = tmp; } elements.push_back(factors[n]); brute_force(n + 1, elements); return; } int main() { int N; cin >> N; for (int i = 2; i <= N; i++) { while (N % i == 0) { factors.push_back(i - 1); N /= i; } if (i * i > N) { if (N > 1) factors.push_back(N - 1); brute_force(0, vector<lint>()); break; } } cout << ans.size() << "\n"; for (auto i : ans) cout << i << " "; }

Compilation message (stderr)

toy.cpp: In function 'void brute_force(int, std::vector<long long int>)':
toy.cpp:9:11: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     if (n == factors.size()) {
         ~~^~~~~~~~~~~~~~~~~
toy.cpp:16:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (auto i = 0; i < elements.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...