# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
581709 | Osplei | Toys (CEOI18_toy) | C++17 | 1 ms | 340 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 pair<int,int> ii;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<ii> vii;
typedef vector<vii> wgraf;
typedef pair<int,ii> edge;
#define UNVISITED 0
#define VISITED 1
#define pb push_back
#define F first
#define S second
vi d;
set <ll> v;
void j (ll p, ll n, ll c){
v.insert(c+n-1);
if (n==1) return;
if (n<d[p]*d[p]) return;
if (p==d.size()) return;
if (n%d[p]==0) j(p, n/d[p], c+d[p]-1);
j(p+1, n, c);
}
int main(){
ios_base::sync_with_stdio(false);
ll n;
cin >> n;
for (ll i=1; i*i<=n; i++){
if (n%i) continue;
if (i>1) d.pb(i);
}
sort (d.begin(), d.end());
j(0, n, 0);
cout << v.size() << "\n";
for (auto &i : v) cout << i << " ";
cout << "\n";
}
Compilation message (stderr)
# | 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... |