# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
548782 | 2022-04-14T11:54:35 Z | Vladth11 | Toys (CEOI18_toy) | C++14 | 1 ms | 212 KB |
#include <bits/stdc++.h> #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " using namespace std; typedef long long ll; typedef pair <ll, ll> pii; typedef pair <pair <ll, ll>, ll > ura; const ll NMAX = 1000001; const ll VMAX = 26; const ll INF = (1LL << 55); const ll MOD = 90000000000000001; const ll BLOCK = 1000000; const ll base = 1000000001; const ll nr_of_bits = 18; set <int> sol; vector <int> divisors; void bkt(int k, int n, int sum){ if(n == 1){ sol.insert(sum); return; } if(k == divisors.size()){ return; } for(int kk = k; kk < divisors.size(); kk++){ if(n < divisors[kk] * divisors[kk]) return; if(n % divisors[kk] == 0){ bkt(kk, n / divisors[kk], sum + divisors[kk] - 1); } } } int main() { ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0); int n, i; cin >> n; for(i = 1; i * i <= n; i++){ if(n % i == 0){ if(n / i == i){ if(i != 1) divisors.push_back(i); }else{ if(i != 1) divisors.push_back(i); divisors.push_back(n / i); } } } sort(divisors.begin(), divisors.end()); bkt(0, n, 0); cout << sol.size() << "\n"; for(auto x : sol){ cout << x << " "; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Incorrect | 0 ms | 212 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |