Submission #81531

# Submission time Handle Problem Language Result Execution time Memory
81531 2018-10-25T08:47:37 Z antimirage Toys (CEOI18_toy) C++17
0 / 100
3 ms 504 KB
#include <bits/stdc++.h>

#define mk make_pair
#define pb push_back
#define fr first
#define sc second

using namespace std;

int n;

vector <int> vec, en;

map <int, vector <int> > mp;

set <int> st;

int main() 
{
	cin >> n;
	assert(n != 1);
	for (int i = 2; i * i <= n; i++)
	{
		if (n % i != 0) continue;
		vec.pb(i);
		if (i != n / i)
			en.pb(n / i);
	}
	en.pb(n);
	for (auto to : en)
		vec.pb(to);
	mp[1].pb(0);
	
	for (int i = 0; i < (int)vec.size(); i++)
	{
		for (int j = 0; j <= i; j++)
		{
			if (vec[i] % vec[j] != 0) continue;
			for (auto to : mp[ vec[i] / vec[j] ])
				mp[ vec[i] ].pb( to + vec[j] - 1 );
		}
	}
	for (auto to : mp[n])
		st.insert(to);
	cout << st.size() << endl;
	for (auto to : st)
		printf("%d ", to);
}
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 3 ms 504 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -