Submission #828458

# Submission time Handle Problem Language Result Execution time Memory
828458 2023-08-17T09:51:30 Z shoryu386 Toys (CEOI18_toy) C++17
0 / 100
0 ms 212 KB
#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

toy.cpp:28:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   28 | main(){
      | ^~~~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -