Submission #81534

#TimeUsernameProblemLanguageResultExecution timeMemory
81534antimirageToys (CEOI18_toy)C++17
59 / 100
2307 ms263168 KiB
#include <bits/stdc++.h> #define mk make_pair #define pb push_back #define fr first #define sc second using namespace std; int n; vector <int> vec; deque <int> en; map <int, vector <int> > mp; set <int> st; int main() { cin >> n; en.pb(n); for (int i = 2; i * i <= n; i++) { if (n % i != 0) continue; vec.pb(i); if (i != n / i) en.push_front(n / i); } for (auto to : en) vec.pb(to); mp[1].pb(0); for (int i = 0; i < (int)vec.size(); i++) { for (int j = 0; j <= i; j++) { if (vec[i] % vec[j] != 0) continue; for (auto to : mp[ vec[i] / vec[j] ]) mp[ vec[i] ].pb( to + vec[j] - 1 ); } } for (auto to : mp[n]) st.insert(to); cout << st.size() << endl; for (auto to : st) printf("%d ", to); }
#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...