Submission #117190

# Submission time Handle Problem Language Result Execution time Memory
117190 2019-06-15T09:23:12 Z teomrn Toys (CEOI18_toy) C++14
100 / 100
1062 ms 22332 KB
#include <bits/stdc++.h>
using namespace std;

map <int, vector <int>> mp;

vector <int> & calc(int x)
{
	if (mp.find(x) != mp.end())
		return mp[x];

	vector <int> v = { x - 1 };
	for (int i = 2; i * i <= x; i++) {
		if (x % i == 0) {
			auto& q = calc(x / i);
			for (auto a : q)
				v.push_back(a + i - 1);
		}
	}
	sort(v.begin(), v.end());
	v.resize(unique(v.begin(), v.end()) - v.begin());
	mp[x] = v;
	return mp[x];
}

int main()
{
	//ifstream in("input.txt");
	//ofstream out("output.txt");

	int n;
	cin >> n;

	auto& x = calc(n);

	cout << x.size() << '\n';

	for (auto i : x)
		cout << i << ' ';
	cout << '\n';


	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 256 KB Output is correct
37 Correct 2 ms 256 KB Output is correct
38 Correct 2 ms 256 KB Output is correct
39 Correct 2 ms 300 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 256 KB Output is correct
37 Correct 2 ms 256 KB Output is correct
38 Correct 2 ms 256 KB Output is correct
39 Correct 2 ms 300 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 3 ms 380 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 3 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 4 ms 384 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 3 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 256 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 2 ms 256 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 256 KB Output is correct
37 Correct 2 ms 256 KB Output is correct
38 Correct 2 ms 256 KB Output is correct
39 Correct 2 ms 300 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 3 ms 380 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 3 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 4 ms 384 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 3 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 256 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 2 ms 256 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 160 ms 5072 KB Output is correct
72 Correct 111 ms 3480 KB Output is correct
73 Correct 183 ms 5008 KB Output is correct
74 Correct 83 ms 2836 KB Output is correct
75 Correct 100 ms 3072 KB Output is correct
76 Correct 288 ms 6236 KB Output is correct
77 Correct 226 ms 5668 KB Output is correct
78 Correct 196 ms 5384 KB Output is correct
79 Correct 191 ms 5460 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 3 ms 384 KB Output is correct
83 Correct 23 ms 1052 KB Output is correct
84 Correct 31 ms 1468 KB Output is correct
85 Correct 8 ms 640 KB Output is correct
86 Correct 3 ms 384 KB Output is correct
87 Correct 33 ms 1504 KB Output is correct
88 Correct 2 ms 256 KB Output is correct
89 Correct 2 ms 256 KB Output is correct
90 Correct 2 ms 256 KB Output is correct
91 Correct 11 ms 768 KB Output is correct
92 Correct 39 ms 1732 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
11 Correct 2 ms 384 KB Output is correct
12 Correct 2 ms 384 KB Output is correct
13 Correct 2 ms 384 KB Output is correct
14 Correct 2 ms 384 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 256 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 256 KB Output is correct
23 Correct 2 ms 384 KB Output is correct
24 Correct 2 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
26 Correct 2 ms 384 KB Output is correct
27 Correct 2 ms 384 KB Output is correct
28 Correct 2 ms 384 KB Output is correct
29 Correct 2 ms 384 KB Output is correct
30 Correct 2 ms 384 KB Output is correct
31 Correct 2 ms 384 KB Output is correct
32 Correct 2 ms 384 KB Output is correct
33 Correct 2 ms 384 KB Output is correct
34 Correct 2 ms 256 KB Output is correct
35 Correct 2 ms 256 KB Output is correct
36 Correct 2 ms 256 KB Output is correct
37 Correct 2 ms 256 KB Output is correct
38 Correct 2 ms 256 KB Output is correct
39 Correct 2 ms 300 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 2 ms 384 KB Output is correct
42 Correct 2 ms 256 KB Output is correct
43 Correct 2 ms 384 KB Output is correct
44 Correct 2 ms 384 KB Output is correct
45 Correct 2 ms 384 KB Output is correct
46 Correct 2 ms 256 KB Output is correct
47 Correct 2 ms 384 KB Output is correct
48 Correct 2 ms 256 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 3 ms 384 KB Output is correct
51 Correct 3 ms 380 KB Output is correct
52 Correct 3 ms 384 KB Output is correct
53 Correct 3 ms 384 KB Output is correct
54 Correct 2 ms 384 KB Output is correct
55 Correct 4 ms 384 KB Output is correct
56 Correct 3 ms 384 KB Output is correct
57 Correct 3 ms 384 KB Output is correct
58 Correct 2 ms 384 KB Output is correct
59 Correct 2 ms 256 KB Output is correct
60 Correct 2 ms 256 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 3 ms 384 KB Output is correct
63 Correct 2 ms 256 KB Output is correct
64 Correct 2 ms 256 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 256 KB Output is correct
67 Correct 2 ms 256 KB Output is correct
68 Correct 2 ms 256 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 160 ms 5072 KB Output is correct
72 Correct 111 ms 3480 KB Output is correct
73 Correct 183 ms 5008 KB Output is correct
74 Correct 83 ms 2836 KB Output is correct
75 Correct 100 ms 3072 KB Output is correct
76 Correct 288 ms 6236 KB Output is correct
77 Correct 226 ms 5668 KB Output is correct
78 Correct 196 ms 5384 KB Output is correct
79 Correct 191 ms 5460 KB Output is correct
80 Correct 2 ms 256 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 3 ms 384 KB Output is correct
83 Correct 23 ms 1052 KB Output is correct
84 Correct 31 ms 1468 KB Output is correct
85 Correct 8 ms 640 KB Output is correct
86 Correct 3 ms 384 KB Output is correct
87 Correct 33 ms 1504 KB Output is correct
88 Correct 2 ms 256 KB Output is correct
89 Correct 2 ms 256 KB Output is correct
90 Correct 2 ms 256 KB Output is correct
91 Correct 11 ms 768 KB Output is correct
92 Correct 39 ms 1732 KB Output is correct
93 Correct 890 ms 19936 KB Output is correct
94 Correct 490 ms 12216 KB Output is correct
95 Correct 563 ms 16728 KB Output is correct
96 Correct 507 ms 11672 KB Output is correct
97 Correct 456 ms 11484 KB Output is correct
98 Correct 1006 ms 22084 KB Output is correct
99 Correct 1062 ms 22332 KB Output is correct
100 Correct 979 ms 21716 KB Output is correct
101 Correct 958 ms 20412 KB Output is correct
102 Correct 857 ms 19232 KB Output is correct
103 Correct 675 ms 17920 KB Output is correct
104 Correct 2 ms 256 KB Output is correct
105 Correct 2 ms 384 KB Output is correct
106 Correct 4 ms 512 KB Output is correct
107 Correct 71 ms 2776 KB Output is correct
108 Correct 177 ms 4920 KB Output is correct
109 Correct 17 ms 948 KB Output is correct
110 Correct 2 ms 384 KB Output is correct
111 Correct 88 ms 3132 KB Output is correct
112 Correct 2 ms 384 KB Output is correct
113 Correct 2 ms 384 KB Output is correct
114 Correct 5 ms 512 KB Output is correct
115 Correct 2 ms 256 KB Output is correct
116 Correct 8 ms 640 KB Output is correct
117 Correct 173 ms 6024 KB Output is correct