Submission #975330

# Submission time Handle Problem Language Result Execution time Memory
975330 2024-05-04T19:35:49 Z IBory Toys (CEOI18_toy) C++17
79 / 100
5000 ms 117432 KB
#include <bits/stdc++.h>
#include <unordered_set>
using namespace std;

const int MAX = 222222;
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) {
		// sort(S[i].begin(), S[i].end());
		// S[i].erase(unique(S[i].begin(), S[i].end()), S[i].end());
		for (int j = i + 1; j < D.size(); ++j) {
			if (D[j] % D[i]) continue;
			for (int n : S[i]) S[j].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;

	cout << S[D.size() - 1].size() << '\n';
	for (int n : S[D.size() - 1]) cout << n << ' ';
	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) {
      |                  ~~^~~~~~~~~~
toy.cpp:23:25: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |   for (int j = i + 1; j < D.size(); ++j) {
      |                       ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 5 ms 12380 KB Output is correct
3 Correct 5 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 6 ms 12400 KB Output is correct
6 Correct 5 ms 12380 KB Output is correct
7 Correct 4 ms 12380 KB Output is correct
8 Correct 4 ms 12380 KB Output is correct
9 Correct 4 ms 12376 KB Output is correct
10 Correct 4 ms 12380 KB Output is correct
11 Correct 5 ms 12380 KB Output is correct
12 Correct 4 ms 12396 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12380 KB Output is correct
15 Correct 4 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 4 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12376 KB Output is correct
20 Correct 4 ms 12380 KB Output is correct
21 Correct 5 ms 12376 KB Output is correct
22 Correct 4 ms 12376 KB Output is correct
23 Correct 4 ms 12380 KB Output is correct
24 Correct 4 ms 12380 KB Output is correct
25 Correct 4 ms 12380 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 5 ms 12380 KB Output is correct
3 Correct 5 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 6 ms 12400 KB Output is correct
6 Correct 5 ms 12380 KB Output is correct
7 Correct 4 ms 12380 KB Output is correct
8 Correct 4 ms 12380 KB Output is correct
9 Correct 4 ms 12376 KB Output is correct
10 Correct 4 ms 12380 KB Output is correct
11 Correct 5 ms 12380 KB Output is correct
12 Correct 4 ms 12396 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12380 KB Output is correct
15 Correct 4 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 4 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12376 KB Output is correct
20 Correct 4 ms 12380 KB Output is correct
21 Correct 5 ms 12376 KB Output is correct
22 Correct 4 ms 12376 KB Output is correct
23 Correct 4 ms 12380 KB Output is correct
24 Correct 4 ms 12380 KB Output is correct
25 Correct 4 ms 12380 KB Output is correct
26 Correct 5 ms 12636 KB Output is correct
27 Correct 4 ms 12636 KB Output is correct
28 Correct 4 ms 12636 KB Output is correct
29 Correct 4 ms 12636 KB Output is correct
30 Correct 4 ms 12636 KB Output is correct
31 Correct 4 ms 12636 KB Output is correct
32 Correct 4 ms 12636 KB Output is correct
33 Correct 5 ms 12636 KB Output is correct
34 Correct 4 ms 12636 KB Output is correct
35 Correct 4 ms 12676 KB Output is correct
36 Correct 4 ms 12632 KB Output is correct
37 Correct 4 ms 12636 KB Output is correct
38 Correct 4 ms 12684 KB Output is correct
39 Correct 4 ms 12636 KB Output is correct
40 Correct 4 ms 12636 KB Output is correct
41 Correct 4 ms 12636 KB Output is correct
42 Correct 4 ms 12688 KB Output is correct
43 Correct 4 ms 12636 KB Output is correct
44 Correct 4 ms 12636 KB Output is correct
45 Correct 4 ms 12888 KB Output is correct
46 Correct 5 ms 12636 KB Output is correct
47 Correct 5 ms 12632 KB Output is correct
48 Correct 4 ms 12632 KB Output is correct
49 Correct 5 ms 12636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 5 ms 12380 KB Output is correct
3 Correct 5 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 6 ms 12400 KB Output is correct
6 Correct 5 ms 12380 KB Output is correct
7 Correct 4 ms 12380 KB Output is correct
8 Correct 4 ms 12380 KB Output is correct
9 Correct 4 ms 12376 KB Output is correct
10 Correct 4 ms 12380 KB Output is correct
11 Correct 5 ms 12380 KB Output is correct
12 Correct 4 ms 12396 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12380 KB Output is correct
15 Correct 4 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 4 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12376 KB Output is correct
20 Correct 4 ms 12380 KB Output is correct
21 Correct 5 ms 12376 KB Output is correct
22 Correct 4 ms 12376 KB Output is correct
23 Correct 4 ms 12380 KB Output is correct
24 Correct 4 ms 12380 KB Output is correct
25 Correct 4 ms 12380 KB Output is correct
26 Correct 5 ms 12636 KB Output is correct
27 Correct 4 ms 12636 KB Output is correct
28 Correct 4 ms 12636 KB Output is correct
29 Correct 4 ms 12636 KB Output is correct
30 Correct 4 ms 12636 KB Output is correct
31 Correct 4 ms 12636 KB Output is correct
32 Correct 4 ms 12636 KB Output is correct
33 Correct 5 ms 12636 KB Output is correct
34 Correct 4 ms 12636 KB Output is correct
35 Correct 4 ms 12676 KB Output is correct
36 Correct 4 ms 12632 KB Output is correct
37 Correct 4 ms 12636 KB Output is correct
38 Correct 4 ms 12684 KB Output is correct
39 Correct 4 ms 12636 KB Output is correct
40 Correct 4 ms 12636 KB Output is correct
41 Correct 4 ms 12636 KB Output is correct
42 Correct 4 ms 12688 KB Output is correct
43 Correct 4 ms 12636 KB Output is correct
44 Correct 4 ms 12636 KB Output is correct
45 Correct 4 ms 12888 KB Output is correct
46 Correct 5 ms 12636 KB Output is correct
47 Correct 5 ms 12632 KB Output is correct
48 Correct 4 ms 12632 KB Output is correct
49 Correct 5 ms 12636 KB Output is correct
50 Correct 6 ms 12892 KB Output is correct
51 Correct 5 ms 12932 KB Output is correct
52 Correct 5 ms 12892 KB Output is correct
53 Correct 5 ms 12892 KB Output is correct
54 Correct 4 ms 12632 KB Output is correct
55 Correct 6 ms 12892 KB Output is correct
56 Correct 7 ms 12892 KB Output is correct
57 Correct 6 ms 13028 KB Output is correct
58 Correct 5 ms 12632 KB Output is correct
59 Correct 5 ms 12636 KB Output is correct
60 Correct 5 ms 12636 KB Output is correct
61 Correct 6 ms 13148 KB Output is correct
62 Correct 4 ms 12636 KB Output is correct
63 Correct 5 ms 12632 KB Output is correct
64 Correct 6 ms 12828 KB Output is correct
65 Correct 6 ms 12892 KB Output is correct
66 Correct 5 ms 12636 KB Output is correct
67 Correct 6 ms 12636 KB Output is correct
68 Correct 5 ms 12836 KB Output is correct
69 Correct 5 ms 12636 KB Output is correct
70 Correct 5 ms 12632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 5 ms 12380 KB Output is correct
3 Correct 5 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 6 ms 12400 KB Output is correct
6 Correct 5 ms 12380 KB Output is correct
7 Correct 4 ms 12380 KB Output is correct
8 Correct 4 ms 12380 KB Output is correct
9 Correct 4 ms 12376 KB Output is correct
10 Correct 4 ms 12380 KB Output is correct
11 Correct 5 ms 12380 KB Output is correct
12 Correct 4 ms 12396 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12380 KB Output is correct
15 Correct 4 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 4 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12376 KB Output is correct
20 Correct 4 ms 12380 KB Output is correct
21 Correct 5 ms 12376 KB Output is correct
22 Correct 4 ms 12376 KB Output is correct
23 Correct 4 ms 12380 KB Output is correct
24 Correct 4 ms 12380 KB Output is correct
25 Correct 4 ms 12380 KB Output is correct
26 Correct 5 ms 12636 KB Output is correct
27 Correct 4 ms 12636 KB Output is correct
28 Correct 4 ms 12636 KB Output is correct
29 Correct 4 ms 12636 KB Output is correct
30 Correct 4 ms 12636 KB Output is correct
31 Correct 4 ms 12636 KB Output is correct
32 Correct 4 ms 12636 KB Output is correct
33 Correct 5 ms 12636 KB Output is correct
34 Correct 4 ms 12636 KB Output is correct
35 Correct 4 ms 12676 KB Output is correct
36 Correct 4 ms 12632 KB Output is correct
37 Correct 4 ms 12636 KB Output is correct
38 Correct 4 ms 12684 KB Output is correct
39 Correct 4 ms 12636 KB Output is correct
40 Correct 4 ms 12636 KB Output is correct
41 Correct 4 ms 12636 KB Output is correct
42 Correct 4 ms 12688 KB Output is correct
43 Correct 4 ms 12636 KB Output is correct
44 Correct 4 ms 12636 KB Output is correct
45 Correct 4 ms 12888 KB Output is correct
46 Correct 5 ms 12636 KB Output is correct
47 Correct 5 ms 12632 KB Output is correct
48 Correct 4 ms 12632 KB Output is correct
49 Correct 5 ms 12636 KB Output is correct
50 Correct 6 ms 12892 KB Output is correct
51 Correct 5 ms 12932 KB Output is correct
52 Correct 5 ms 12892 KB Output is correct
53 Correct 5 ms 12892 KB Output is correct
54 Correct 4 ms 12632 KB Output is correct
55 Correct 6 ms 12892 KB Output is correct
56 Correct 7 ms 12892 KB Output is correct
57 Correct 6 ms 13028 KB Output is correct
58 Correct 5 ms 12632 KB Output is correct
59 Correct 5 ms 12636 KB Output is correct
60 Correct 5 ms 12636 KB Output is correct
61 Correct 6 ms 13148 KB Output is correct
62 Correct 4 ms 12636 KB Output is correct
63 Correct 5 ms 12632 KB Output is correct
64 Correct 6 ms 12828 KB Output is correct
65 Correct 6 ms 12892 KB Output is correct
66 Correct 5 ms 12636 KB Output is correct
67 Correct 6 ms 12636 KB Output is correct
68 Correct 5 ms 12836 KB Output is correct
69 Correct 5 ms 12636 KB Output is correct
70 Correct 5 ms 12632 KB Output is correct
71 Correct 889 ms 39820 KB Output is correct
72 Correct 711 ms 34528 KB Output is correct
73 Correct 571 ms 34720 KB Output is correct
74 Correct 430 ms 29244 KB Output is correct
75 Correct 398 ms 29332 KB Output is correct
76 Correct 1089 ms 46392 KB Output is correct
77 Correct 1028 ms 43172 KB Output is correct
78 Correct 945 ms 42156 KB Output is correct
79 Correct 878 ms 40472 KB Output is correct
80 Correct 1041 ms 30472 KB Output is correct
81 Correct 999 ms 27312 KB Output is correct
82 Correct 698 ms 26684 KB Output is correct
83 Correct 631 ms 26704 KB Output is correct
84 Correct 266 ms 21872 KB Output is correct
85 Correct 1020 ms 31004 KB Output is correct
86 Correct 1022 ms 30036 KB Output is correct
87 Correct 958 ms 30584 KB Output is correct
88 Correct 1016 ms 30032 KB Output is correct
89 Correct 1026 ms 30332 KB Output is correct
90 Correct 1020 ms 30556 KB Output is correct
91 Correct 1016 ms 31060 KB Output is correct
92 Correct 1002 ms 30988 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 12376 KB Output is correct
2 Correct 5 ms 12380 KB Output is correct
3 Correct 5 ms 12376 KB Output is correct
4 Correct 4 ms 12380 KB Output is correct
5 Correct 6 ms 12400 KB Output is correct
6 Correct 5 ms 12380 KB Output is correct
7 Correct 4 ms 12380 KB Output is correct
8 Correct 4 ms 12380 KB Output is correct
9 Correct 4 ms 12376 KB Output is correct
10 Correct 4 ms 12380 KB Output is correct
11 Correct 5 ms 12380 KB Output is correct
12 Correct 4 ms 12396 KB Output is correct
13 Correct 4 ms 12380 KB Output is correct
14 Correct 4 ms 12380 KB Output is correct
15 Correct 4 ms 12380 KB Output is correct
16 Correct 4 ms 12380 KB Output is correct
17 Correct 4 ms 12380 KB Output is correct
18 Correct 4 ms 12380 KB Output is correct
19 Correct 4 ms 12376 KB Output is correct
20 Correct 4 ms 12380 KB Output is correct
21 Correct 5 ms 12376 KB Output is correct
22 Correct 4 ms 12376 KB Output is correct
23 Correct 4 ms 12380 KB Output is correct
24 Correct 4 ms 12380 KB Output is correct
25 Correct 4 ms 12380 KB Output is correct
26 Correct 5 ms 12636 KB Output is correct
27 Correct 4 ms 12636 KB Output is correct
28 Correct 4 ms 12636 KB Output is correct
29 Correct 4 ms 12636 KB Output is correct
30 Correct 4 ms 12636 KB Output is correct
31 Correct 4 ms 12636 KB Output is correct
32 Correct 4 ms 12636 KB Output is correct
33 Correct 5 ms 12636 KB Output is correct
34 Correct 4 ms 12636 KB Output is correct
35 Correct 4 ms 12676 KB Output is correct
36 Correct 4 ms 12632 KB Output is correct
37 Correct 4 ms 12636 KB Output is correct
38 Correct 4 ms 12684 KB Output is correct
39 Correct 4 ms 12636 KB Output is correct
40 Correct 4 ms 12636 KB Output is correct
41 Correct 4 ms 12636 KB Output is correct
42 Correct 4 ms 12688 KB Output is correct
43 Correct 4 ms 12636 KB Output is correct
44 Correct 4 ms 12636 KB Output is correct
45 Correct 4 ms 12888 KB Output is correct
46 Correct 5 ms 12636 KB Output is correct
47 Correct 5 ms 12632 KB Output is correct
48 Correct 4 ms 12632 KB Output is correct
49 Correct 5 ms 12636 KB Output is correct
50 Correct 6 ms 12892 KB Output is correct
51 Correct 5 ms 12932 KB Output is correct
52 Correct 5 ms 12892 KB Output is correct
53 Correct 5 ms 12892 KB Output is correct
54 Correct 4 ms 12632 KB Output is correct
55 Correct 6 ms 12892 KB Output is correct
56 Correct 7 ms 12892 KB Output is correct
57 Correct 6 ms 13028 KB Output is correct
58 Correct 5 ms 12632 KB Output is correct
59 Correct 5 ms 12636 KB Output is correct
60 Correct 5 ms 12636 KB Output is correct
61 Correct 6 ms 13148 KB Output is correct
62 Correct 4 ms 12636 KB Output is correct
63 Correct 5 ms 12632 KB Output is correct
64 Correct 6 ms 12828 KB Output is correct
65 Correct 6 ms 12892 KB Output is correct
66 Correct 5 ms 12636 KB Output is correct
67 Correct 6 ms 12636 KB Output is correct
68 Correct 5 ms 12836 KB Output is correct
69 Correct 5 ms 12636 KB Output is correct
70 Correct 5 ms 12632 KB Output is correct
71 Correct 889 ms 39820 KB Output is correct
72 Correct 711 ms 34528 KB Output is correct
73 Correct 571 ms 34720 KB Output is correct
74 Correct 430 ms 29244 KB Output is correct
75 Correct 398 ms 29332 KB Output is correct
76 Correct 1089 ms 46392 KB Output is correct
77 Correct 1028 ms 43172 KB Output is correct
78 Correct 945 ms 42156 KB Output is correct
79 Correct 878 ms 40472 KB Output is correct
80 Correct 1041 ms 30472 KB Output is correct
81 Correct 999 ms 27312 KB Output is correct
82 Correct 698 ms 26684 KB Output is correct
83 Correct 631 ms 26704 KB Output is correct
84 Correct 266 ms 21872 KB Output is correct
85 Correct 1020 ms 31004 KB Output is correct
86 Correct 1022 ms 30036 KB Output is correct
87 Correct 958 ms 30584 KB Output is correct
88 Correct 1016 ms 30032 KB Output is correct
89 Correct 1026 ms 30332 KB Output is correct
90 Correct 1020 ms 30556 KB Output is correct
91 Correct 1016 ms 31060 KB Output is correct
92 Correct 1002 ms 30988 KB Output is correct
93 Execution timed out 5034 ms 117432 KB Time limit exceeded
94 Halted 0 ms 0 KB -