Submission #975333

# Submission time Handle Problem Language Result Execution time Memory
975333 2024-05-04T19:42:01 Z IBory Toys (CEOI18_toy) C++17
0 / 100
3 ms 6492 KB
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;

const int MAX = 111111;
vector<int> D;
unordered_set<int> S[MAX];

int main() {
	int N;
	cin >> N;

	for (int i = 1; i * i <= N; ++i) {
		D.push_back(i);
		if (i * i != N) D.push_back(N / i);
	}
	sort(D.begin(), D.end());
	S[0].insert(0);

	for (int i = 0; i < D.size(); ++i) {
		for (int j = 0; j < i; ++j) {
			if (D[i] % D[j]) continue;
			for (int n : S[j]) S[i].insert(n + D[j] / D[i] - 1);
		}
	}

	vector<int> ans;
	for (int n : S[D.size() - 1]) ans.push_back(n);
	sort(ans.begin(), ans.end());
	cout << ans.size() << '\n';
	for (int n : ans) cout << n << ' ';
	return 0;
	return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:20:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   20 |  for (int i = 0; i < D.size(); ++i) {
      |                  ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6488 KB Output is correct
2 Incorrect 3 ms 6492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6488 KB Output is correct
2 Incorrect 3 ms 6492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6488 KB Output is correct
2 Incorrect 3 ms 6492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6488 KB Output is correct
2 Incorrect 3 ms 6492 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 6488 KB Output is correct
2 Incorrect 3 ms 6492 KB Output isn't correct
3 Halted 0 ms 0 KB -