Submission #536817

#TimeUsernameProblemLanguageResultExecution timeMemory
536817maomao90Toys (CEOI18_toy)C++17
79 / 100
5059 ms53900 KiB
// Hallelujah, praise the one who set me free // Hallelujah, death has lost its grip on me // You have broken every chain, There's salvation in your name // Jesus Christ, my living hope #include <bits/stdc++.h> using namespace std; template <class T> inline bool mnto(T& a, T b) {return a > b ? a = b, 1 : 0;} template <class T> inline bool mxto(T& a, T b) {return a < b ? a = b, 1: 0;} #define REP(i, s, e) for (int i = s; i < e; i++) #define RREP(i, s, e) for (int i = s; i >= e; i--) typedef long long ll; typedef long double ld; #define MP make_pair #define FI first #define SE second typedef pair<int, int> ii; typedef pair<ll, ll> pll; #define MT make_tuple typedef tuple<int, int, int> iii; #define ALL(_a) _a.begin(), _a.end() #define pb push_back typedef vector<int> vi; typedef vector<ll> vll; typedef vector<ii> vii; #ifndef DEBUG #define cerr if (0) cerr #endif #define INF 1000000005 #define LINF 1000000000000000005ll #define MAXN 200005 int n; unordered_set<int> st; set<ii> vis; void dp(int n, int cur) { if (vis.find(MP(n, cur)) != vis.end()) return; for (int i = 2; i * i <= n; i++) { if (n % i == 0) { dp(n / i, cur + i - 1); if (i * i == n) break; } } st.insert(cur + n - 1); vis.insert(MP(n, cur)); } int main() { #ifndef DEBUG ios::sync_with_stdio(0), cin.tie(0); #endif cin >> n; dp(n, 0); cout << st.size() << '\n'; vi v; for (int i : st) { v.pb(i); //cout << i << ' '; } sort(ALL(v)); for (int i : v) { 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...