Submission #73260

#TimeUsernameProblemLanguageResultExecution timeMemory
73260duckmoon99Toys (CEOI18_toy)C++14
59 / 100
5028 ms101664 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; set <ll> dp[111111]; int main(){ int n; cin >> n; if(n==1){ cout << 1 << '\n' << 0; ret 0; } for(int i = 2; i <= n; i++){ dp[i].insert(i-1); for(int j = 2; j <= sqrt(n); j++){ if(i%j==0){ for(auto it: dp[j]){ for(auto itt: dp[i/j]){ dp[i].insert(it+itt); } } } } } 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...