# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
494338 | fcmalkcin | Toys (CEOI18_toy) | C++17 | 1871 ms | 4352 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.
/*#pragma GCC optimize("Ofast")
#pragma GCC optimization("unroll-loops, no-stack-protector")
#pragma GCC target("avx,avx2,fma")*/
#include <bits/stdc++.h>
using namespace std;
#define ll int
#define pll pair<ll,ll>
#define ff first
#define ss second
#define pb push_back
#define endl "\n"
mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
const ll maxn=5e5+5;
const ll mod=1e9+7 ;
const ll base=3e18;
/// you will be the best but now you just are trash
/// goal 1/7
set<ll> st;
void dosth(ll n,ll a,ll l)
{
if (n==1)
{
st.insert(a);
return ;
}
for (int j=1;j*j<=n;j++)
{
if (n%j==0)
{
if (j>=l) dosth(n/j,a+j-1,j);
if (n/j>=l) dosth(j,a+n/j-1,n/j);
}
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
if (fopen("t.inp", "r"))
{
freopen("test.inp", "r", stdin);
freopen("test.out", "w", stdout);
}
ll n;
cin>> n;
dosth(n,0,2);
cout <<st.size()<<endl;
for (auto to:st)
{
cout <<to<<" ";
}
}
/*1
10 6
0 9 16
0 6 2
1 5 10 15
*/
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... |