# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1007880 | 2024-06-25T16:42:24 Z | canonica1 | Toys (CEOI18_toy) | C++17 | 0 ms | 348 KB |
#include <algorithm> #include <iostream> #include <vector> #include <set> using namespace std; vector<int> ans; vector<int> factors; vector<vector<int>> g; vector<set<int>> M; void rec(int n, int answer) { if(M[n].find(answer) != M[n].end()) return; M[n].insert(answer); if (factors[n] == 1) { ans.push_back(answer); return; } for(auto d : g[n]) { rec(d, answer + factors[n] / factors[d] - 1); } } int main() { int n; cin >> n; for (int i = 1; i * i <= n; i++) { if (n % i == 0) { factors.push_back(i); if (i * i != n) { factors.push_back(n / i); } } } g.resize(factors.size()); M.resize(factors.size()); for(int i = 0; i < factors.size(); i++){ for(int j = i + 1; j < factors.size(); j++){ if(factors[j] % factors[i] == 0){ g[j].push_back(i); } } } rec(factors.size() - 1, 0); sort(ans.begin(), ans.end()); cout << ans.size() << endl; for (auto x : ans) { cout << x << " "; } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Incorrect | 0 ms | 348 KB | Output isn't correct |
5 | Halted | 0 ms | 0 KB | - |