Submission #536921

# Submission time Handle Problem Language Result Execution time Memory
536921 2022-03-14T07:36:32 Z Hydroxic_Acid Toys (CEOI18_toy) C++17
0 / 100
1 ms 212 KB
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <map>
using namespace std;

int n;
vector<int> v;
vector<int> ans;

void dp(int idx, int curr, vector<int> temp){
	if(idx == (int)v.size()){
		ans.push_back(curr - (int)temp.size());
		return;
	}
	for(int i = (int)temp.size() - 1; i >= 0; i--){
		temp[i] *= v[idx];
		dp(idx + 1, curr + temp[i] - temp[i] / v[idx], temp);
		temp[i] /= v[idx];
	}
	temp.push_back(v[idx]);
	dp(idx + 1, curr + v[idx], temp);
}

int main(){
	cin >> n;
	int f = 2;
	while(f <= (int)sqrt(n) + 1 && n > 1){
		if(n % f == 0){
			v.push_back(f);
			n = n/f;
		}
		else f++;
	}
	if(n > 1) v.push_back(n);
	cout << (1 << ((int)v.size() - 1)) << "\n";
	vector<int> temp;
	dp(0, 0, temp);
	sort(ans.begin(), ans.end());
	for(int i = 0; i < (int)ans.size(); i++){
		if(i == 0 || ans[i - 1] != ans[i]) cout << ans[i] << " ";
	}
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -