제출 #828460

#제출 시각아이디문제언어결과실행 시간메모리
828460shoryu386Toys (CEOI18_toy)C++17
100 / 100
2501 ms93804 KiB
#include <bits/stdc++.h> using namespace std; #define int long long map<int, set<int>> deepee; set<int> recur(int n){ if (n == 1) return {1}; if (deepee.count(n) != 0) return deepee[n]; 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 deepee[n] = ret; } main(){ int n; cin >> n; set<int> ans = recur(n); cout << ans.size() << '\n'; for (auto x : ans){ cout << x-1 << ' '; } }

컴파일 시 표준 에러 (stderr) 메시지

toy.cpp:31:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   31 | 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...