# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
470911 | 2021-09-06T07:48:35 Z | prvocislo | Toys (CEOI18_toy) | C++17 | 1 ms | 204 KB |
#include <iostream> #include <vector> #include <algorithm> #include <set> #include <map> typedef long long ll; using namespace std; void divisors(int n, vector<int> &di) { for (int i = 1; i * i <= n; i++) if (n % i == 0) { di.push_back(i); if (n / i != i) di.push_back(n / i); } sort(di.begin(), di.end()); } int main() { ios::sync_with_stdio(false); cin.tie(0); int n; cin >> n; vector<int> v; divisors(n, v); int k = v.size(); vector<vector<int> > d(v.size()); for (int i = 0; i < v.size(); i++) { divisors(v[i], d[i]); for (int j = 0; j < d[i].size(); j++) d[i][j] = lower_bound(v.begin(), v.end(), d[i][j]) - v.begin(); } vector<vector<int> > mul(k, vector<int>(k, -1)); for (int i = 0; i < k; i++) for (int j : d[k - 1 - i]) { int x = v[i] * v[j]; mul[i][j] = lower_bound(v.begin(), v.end(), x) - v.begin(); } vector<set<int> > dp(k); dp[0].insert(0); set<int> ans; for (int i = 1; i < k; i++) { if (i <= (k - 1) / 2) { for (int m : d[k - 1 - i]) { for (int s : dp[m]) { dp[mul[i][m]].insert(s + v[i] - 1); } } } for (int s : dp[k - 1 - i]) { ans.insert(s + v[i] - 1); } } cout << ans.size() << "\n"; for (int i : ans) cout << i << " "; cout << "\n"; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |