Submission #75380

#TimeUsernameProblemLanguageResultExecution timeMemory
75380dooweyToys (CEOI18_toy)C++14
0 / 100
2 ms624 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double db; typedef pair<int,int> pii; #define fi first #define se second #define mp make_pair #define fastIO std::ios::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define TEST freopen("in.txt","r",stdin); #define ones(a) __builtin_popcount(a); #define pq priority_queue vector<int> divis; void divide(int n){ for(int i = 1;i * i <= n;i ++ ){ if(n % i == 0){ divis.push_back(i); if(i*i < n) divis.push_back(n/i); } } sort(divis.begin(), divis.end()); } int main(){ fastIO; int n; cin >> n; divide(n); int tot = divis.size(); unordered_set<int> options[tot]; options[0].insert(0); int fr, sr; for(int i = 0;i < tot;i ++ ){ fr = divis[i]; for(int j = i + 1;j < tot; j ++ ){ sr = divis[j]; if(sr % fr != 0) continue; sr /= fr; sr -- ; for(auto x : options[i]) options[j].insert(x + sr); } } vector<int>answer; for(auto x : options[tot - 1]){ answer.push_back(x); } cout << answer.size() << "\n"; for(auto x : answer) cout << x << " "; 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...