# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|
1096085 | | mar | Toys (CEOI18_toy) | C++14 | | 5035 ms | 164200 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll maxn =1000000008;
map < ll, map < ll, bool > > m;
ll n;
ll sz;
vector<ll>divs;
void rec(ll cur, ll sum, ll last){
if(m[cur][sum]) return;
m[cur][sum] = true;
if(cur == n) return;
for(ll i = last; i < sz; i++){
ll d = divs[i];
if(cur*d > n) continue;
if(!m[cur * d][sum + d - 1]) rec(cur*d, sum+d-1, i);
}
}
int main(){
cin>>n;
for(ll i = 2; i*i <= n; i++){
if(n % i == 0) {
divs.push_back(i);
if(i*i != n) divs.push_back(n / i);
}
}
divs.push_back(n);
sz = divs.size();
sort(divs.begin(), divs.end());
rec(1,0,0);
cout << m[n].size() << endl;
for(auto x : m[n]) cout << x.first << " ";
cout << endl;
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... |