| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1345958 | kawhiet | Toys (CEOI18_toy) | C++20 | 5094 ms | 1816 KiB |
#include <bits/stdc++.h>
using namespace std;
#ifdef LOCAL
#include "debug.h"
#else
#define dbg(...) 47
#endif
set<int> s;
void go(int n, int cnt, int sum, int prv) {
if (n == 1) {
s.insert(sum);
return;
}
if (cnt == 0) {
return;
}
for (int x = prv + 1; ; x++) {
int k = 1;
for (int i = 0; i < cnt; i++) {
k *= x;
if (k > n) break;
}
if (k > n) break;
if (n % x > 0) continue;
int v = n, s = 0;
while (v % x == 0 && cnt > s) {
v /= x;
s++;
go(v, cnt - s, sum + (x - 1) * s, x);
}
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int n;
cin >> n;
go(n, 30, 0, 0);
cout << s.size() << '\n';
for (auto x : s) {
cout << x << ' ';
}
cout << '\n';
return 0;
}| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
