Submission #493219

#TimeUsernameProblemLanguageResultExecution timeMemory
493219blueToys (CEOI18_toy)C++17
59 / 100
724 ms262148 KiB
#include <iostream> #include <vector> #include <set> #include <algorithm> using namespace std; #define sz(x) (int(x.size())) int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); int n; cin >> n; vector<int> res[1+n]; for(int i = 1; i <= n; i++) { res[i].push_back(i-1); for(int j = 1; j < i && j*j <= i; j++) { if(i % j == 0) { int u = j; int v = i/j; for(int a: res[u]) for(int b: res[v]) res[i].push_back(a+b); // break; } } sort(res[i].begin(), res[i].end()); res[i].erase(unique(res[i].begin(), res[i].end()), res[i].end()); // cerr << i << " : " << sz(res[i]) << '\n'; } cout << sz(res[n]) << '\n'; for(int r: res[n]) cout << r << ' '; cout << '\n'; }
#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...