Submission #444711

#TimeUsernameProblemLanguageResultExecution timeMemory
444711definitelynotmeeToys (CEOI18_toy)C++98
59 / 100
5078 ms824 KiB
#include<bits/stdc++.h> #define mp make_pair #define mt make_tuple #define ff first #define ss second using namespace std; typedef long long ll; typedef pair<int,int> pii; typedef pair<ll,ll> pll; const ll INFL = (1LL<<62)-1; const int INF = (1<<30)-1; const double EPS = 1e-7; const int MOD = 1e9 + 7; const int MAXN = 1e6+1; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; set<int> resp; function<void(int,int,int)> bt =[&resp,&bt](int n, int cur, int sum){ if(n==1){ resp.insert(sum); return; } for(int i = cur; i <= sqrt(n); i++){ if(n%i == 0) bt(n/i,cur,sum+i-1); } //cout << "->" << n << ' ' << sum << '\n'; bt(1,n,sum+n-1); }; bt(n,2,0); cout << resp.size() << '\n'; for(int i : resp) cout << i << ' '; cout << '\n'; return 0; }
#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...