# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
161387 | 2019-11-02T07:09:02 Z | rama_pang | Toys (CEOI18_toy) | C++14 | 2 ms | 252 KB |
#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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 252 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |