Submission #318124

#TimeUsernameProblemLanguageResultExecution timeMemory
318124nekiToys (CEOI18_toy)C++14
59 / 100
5003 ms1220 KiB
#include <bits/stdc++.h> #define loop(i, a, b) for(long long i=a;i<b;i++) #define pool(i, a, b) for(long long i=a-1;i>=b;i--) #define fore(i, a) for(auto&& i:a) #define fi first #define se second #define ps(a) push_back(a) #define pb(a) pop_back(a) #define sc scanf #define vc vector #define pa pair<ll, ll> #define ll long long #define lb lower_bound #define ub upper_bound #define all(a) a.begin(), a.end() #define llmax LLONG_MAX/2 #define llmin -LLONG_MAX/2 using namespace std; #define mn 100100 #define pa pair<ll, ll> #define ld long double map<ll, ll> solve(ll n){ map<ll, ll> ans;ans[n-1]=1; for(ll i=2;i * i <=n;i++){ if(n%i==0){ fore(v, solve(i)) ans[n/i-1+v.fi]=1; fore(v, solve(n/i)) ans[i-1+v.fi]=1; } } return ans; } int main(){ ll n;cin >> n; auto ans=solve(n); cout << ans.size()<<endl; fore(v, ans) cout << v.fi <<" "; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...