Submission #828458

#TimeUsernameProblemLanguageResultExecution timeMemory
828458shoryu386Toys (CEOI18_toy)C++17
0 / 100
0 ms212 KiB
#include <bits/stdc++.h> using namespace std; #define int long long set<int> recur(int n){ if (n == 1) return {1}; set<int> ret; for (int x = 1; x <= sqrt(n); x++){ if (n % x == 0) { //cerr << "wat " << n/x << ' ' << x << '\n'; if (n/x != n){ for (auto y : recur(n/x)){ ret.insert(x - 1 + y); } } for (auto y : recur(x)){ ret.insert(n/x -1 + y); } } } return ret; } main(){ int n; cin >> n; set<int> ans = recur(n); cout << ans.size() << '\n'; for (auto x : ans){ cout << x << ' '; } }

Compilation message (stderr)

toy.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main(){
      | ^~~~
#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...