제출 #73267

#제출 시각아이디문제언어결과실행 시간메모리
73267duckmoon99Toys (CEOI18_toy)C++14
59 / 100
5015 ms25108 KiB
#include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace std; using namespace __gnu_pbds; #define fi first #define se second #define mp make_pair #define pb push_back #define fbo find_by_order #define ook order_of_key #define INF 1e18 #define ret return typedef long long ll; typedef pair<int,int> ii; typedef vector<int> vi; typedef vector < pair<int, int> > vii; typedef long double ld; typedef tree<pair<int,int>, null_type, less<pair<int,int> >, rb_tree_tag, tree_order_statistics_node_update> pbds; typedef set<int>::iterator sit; typedef map<int,int>::iterator mit; typedef vector<int>::iterator vit; map <int, set<int> > dp; void solve(int n){ dp[n].insert(n-1); for(int i = 2; i <= sqrt(n); i++){ if(n%i==0){ if(dp[i].empty())solve(i); if(dp[n/i].empty())solve(n/i); for(auto it: dp[i]){ for(auto itt: dp[n/i]){ dp[n].insert(it+itt); } } } } } int main(){ int n; cin >> n; if(n==1){ cout << 1 << '\n' << 0; ret 0; } solve(n); cout << dp[n].size() << endl; for(auto it: dp[n]){ cout << it << " "; } }
#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...