Submission #426344

# Submission time Handle Problem Language Result Execution time Memory
426344 2021-06-13T18:41:27 Z linkret Toys (CEOI18_toy) C++14
100 / 100
1464 ms 24784 KB
#include <bits/stdc++.h>
using namespace std;
map <int, int> m; vector <int> dp [100000]; vector <int> dj; int n;
vector <int> rek (int x){
	//cout << x << endl;
	vector <int> s;
	if (dp[m[x]].size()!=0) return dp[m[x]];
	if (x==1) return {0};
	for (int i=0; i<dj.size(); i++){
		if (sqrt(x)<dj[i]) break;
		else if (x%dj[i]==0){
			vector <int> s3, s2;
			if (i!=0){
				s2=rek (x/dj[i]);
				for (auto it:s2) s3.push_back (it+dj[i]-1);
			}
			s2=rek (x/(x/dj[i]));
			for (auto it:s2) s3.push_back (it+(x/dj[i])-1);
			for (auto e : s3)
				s.push_back(e);
		}
	}
	sort (s.begin(), s.end());
	s.erase(unique(s.begin(), s.end()), s.end());
	return dp [m[x]]=s;
}
int main(){
	cin >> n; int now=0;
	dj.push_back(n);
	for (int i=1; i<=sqrt (n); i++){
		if (n%i==0){
			m [i]=now; m[n/i]=now+1; now+=2;
			dj.push_back(i); dj.push_back(n/i);
		}
	}
	sort (dj.begin(), dj.end());
	vector <int> ans = rek (n);
	cout << ans.size() << endl;
	for (auto it:ans) cout << it << " ";
}

Compilation message

toy.cpp: In function 'std::vector<int> rek(int)':
toy.cpp:9:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |  for (int i=0; i<dj.size(); i++){
      |                ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 2 ms 2636 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 2 ms 2636 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 3 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 2 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 3 ms 2636 KB Output is correct
32 Correct 3 ms 2636 KB Output is correct
33 Correct 3 ms 2636 KB Output is correct
34 Correct 2 ms 2636 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 2 ms 2644 KB Output is correct
37 Correct 2 ms 2636 KB Output is correct
38 Correct 2 ms 2636 KB Output is correct
39 Correct 2 ms 2636 KB Output is correct
40 Correct 2 ms 2636 KB Output is correct
41 Correct 2 ms 2636 KB Output is correct
42 Correct 3 ms 2636 KB Output is correct
43 Correct 3 ms 2636 KB Output is correct
44 Correct 2 ms 2636 KB Output is correct
45 Correct 2 ms 2636 KB Output is correct
46 Correct 2 ms 2636 KB Output is correct
47 Correct 3 ms 2588 KB Output is correct
48 Correct 2 ms 2636 KB Output is correct
49 Correct 2 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 2 ms 2636 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 3 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 2 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 3 ms 2636 KB Output is correct
32 Correct 3 ms 2636 KB Output is correct
33 Correct 3 ms 2636 KB Output is correct
34 Correct 2 ms 2636 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 2 ms 2644 KB Output is correct
37 Correct 2 ms 2636 KB Output is correct
38 Correct 2 ms 2636 KB Output is correct
39 Correct 2 ms 2636 KB Output is correct
40 Correct 2 ms 2636 KB Output is correct
41 Correct 2 ms 2636 KB Output is correct
42 Correct 3 ms 2636 KB Output is correct
43 Correct 3 ms 2636 KB Output is correct
44 Correct 2 ms 2636 KB Output is correct
45 Correct 2 ms 2636 KB Output is correct
46 Correct 2 ms 2636 KB Output is correct
47 Correct 3 ms 2588 KB Output is correct
48 Correct 2 ms 2636 KB Output is correct
49 Correct 2 ms 2636 KB Output is correct
50 Correct 4 ms 2708 KB Output is correct
51 Correct 4 ms 2636 KB Output is correct
52 Correct 4 ms 2636 KB Output is correct
53 Correct 3 ms 2636 KB Output is correct
54 Correct 4 ms 2636 KB Output is correct
55 Correct 5 ms 2764 KB Output is correct
56 Correct 5 ms 2636 KB Output is correct
57 Correct 5 ms 2636 KB Output is correct
58 Correct 3 ms 2556 KB Output is correct
59 Correct 3 ms 2636 KB Output is correct
60 Correct 2 ms 2636 KB Output is correct
61 Correct 3 ms 2636 KB Output is correct
62 Correct 3 ms 2636 KB Output is correct
63 Correct 2 ms 2636 KB Output is correct
64 Correct 2 ms 2636 KB Output is correct
65 Correct 3 ms 2636 KB Output is correct
66 Correct 2 ms 2636 KB Output is correct
67 Correct 2 ms 2636 KB Output is correct
68 Correct 2 ms 2636 KB Output is correct
69 Correct 3 ms 2636 KB Output is correct
70 Correct 3 ms 2636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 2 ms 2636 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 3 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 2 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 3 ms 2636 KB Output is correct
32 Correct 3 ms 2636 KB Output is correct
33 Correct 3 ms 2636 KB Output is correct
34 Correct 2 ms 2636 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 2 ms 2644 KB Output is correct
37 Correct 2 ms 2636 KB Output is correct
38 Correct 2 ms 2636 KB Output is correct
39 Correct 2 ms 2636 KB Output is correct
40 Correct 2 ms 2636 KB Output is correct
41 Correct 2 ms 2636 KB Output is correct
42 Correct 3 ms 2636 KB Output is correct
43 Correct 3 ms 2636 KB Output is correct
44 Correct 2 ms 2636 KB Output is correct
45 Correct 2 ms 2636 KB Output is correct
46 Correct 2 ms 2636 KB Output is correct
47 Correct 3 ms 2588 KB Output is correct
48 Correct 2 ms 2636 KB Output is correct
49 Correct 2 ms 2636 KB Output is correct
50 Correct 4 ms 2708 KB Output is correct
51 Correct 4 ms 2636 KB Output is correct
52 Correct 4 ms 2636 KB Output is correct
53 Correct 3 ms 2636 KB Output is correct
54 Correct 4 ms 2636 KB Output is correct
55 Correct 5 ms 2764 KB Output is correct
56 Correct 5 ms 2636 KB Output is correct
57 Correct 5 ms 2636 KB Output is correct
58 Correct 3 ms 2556 KB Output is correct
59 Correct 3 ms 2636 KB Output is correct
60 Correct 2 ms 2636 KB Output is correct
61 Correct 3 ms 2636 KB Output is correct
62 Correct 3 ms 2636 KB Output is correct
63 Correct 2 ms 2636 KB Output is correct
64 Correct 2 ms 2636 KB Output is correct
65 Correct 3 ms 2636 KB Output is correct
66 Correct 2 ms 2636 KB Output is correct
67 Correct 2 ms 2636 KB Output is correct
68 Correct 2 ms 2636 KB Output is correct
69 Correct 3 ms 2636 KB Output is correct
70 Correct 3 ms 2636 KB Output is correct
71 Correct 213 ms 7476 KB Output is correct
72 Correct 148 ms 6768 KB Output is correct
73 Correct 204 ms 7200 KB Output is correct
74 Correct 113 ms 5224 KB Output is correct
75 Correct 137 ms 5100 KB Output is correct
76 Correct 331 ms 8628 KB Output is correct
77 Correct 300 ms 8048 KB Output is correct
78 Correct 262 ms 7760 KB Output is correct
79 Correct 255 ms 7924 KB Output is correct
80 Correct 2 ms 2636 KB Output is correct
81 Correct 2 ms 2636 KB Output is correct
82 Correct 4 ms 2636 KB Output is correct
83 Correct 30 ms 3476 KB Output is correct
84 Correct 39 ms 3704 KB Output is correct
85 Correct 10 ms 2988 KB Output is correct
86 Correct 2 ms 2636 KB Output is correct
87 Correct 42 ms 3808 KB Output is correct
88 Correct 2 ms 2636 KB Output is correct
89 Correct 2 ms 2636 KB Output is correct
90 Correct 2 ms 2636 KB Output is correct
91 Correct 13 ms 3008 KB Output is correct
92 Correct 59 ms 4104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 2636 KB Output is correct
2 Correct 2 ms 2636 KB Output is correct
3 Correct 2 ms 2636 KB Output is correct
4 Correct 2 ms 2636 KB Output is correct
5 Correct 2 ms 2636 KB Output is correct
6 Correct 2 ms 2636 KB Output is correct
7 Correct 2 ms 2636 KB Output is correct
8 Correct 2 ms 2636 KB Output is correct
9 Correct 2 ms 2636 KB Output is correct
10 Correct 2 ms 2636 KB Output is correct
11 Correct 2 ms 2636 KB Output is correct
12 Correct 2 ms 2636 KB Output is correct
13 Correct 2 ms 2636 KB Output is correct
14 Correct 2 ms 2636 KB Output is correct
15 Correct 2 ms 2636 KB Output is correct
16 Correct 2 ms 2636 KB Output is correct
17 Correct 2 ms 2636 KB Output is correct
18 Correct 2 ms 2636 KB Output is correct
19 Correct 2 ms 2636 KB Output is correct
20 Correct 2 ms 2636 KB Output is correct
21 Correct 2 ms 2636 KB Output is correct
22 Correct 2 ms 2636 KB Output is correct
23 Correct 2 ms 2636 KB Output is correct
24 Correct 2 ms 2636 KB Output is correct
25 Correct 2 ms 2636 KB Output is correct
26 Correct 3 ms 2636 KB Output is correct
27 Correct 2 ms 2636 KB Output is correct
28 Correct 2 ms 2636 KB Output is correct
29 Correct 2 ms 2636 KB Output is correct
30 Correct 2 ms 2636 KB Output is correct
31 Correct 3 ms 2636 KB Output is correct
32 Correct 3 ms 2636 KB Output is correct
33 Correct 3 ms 2636 KB Output is correct
34 Correct 2 ms 2636 KB Output is correct
35 Correct 2 ms 2636 KB Output is correct
36 Correct 2 ms 2644 KB Output is correct
37 Correct 2 ms 2636 KB Output is correct
38 Correct 2 ms 2636 KB Output is correct
39 Correct 2 ms 2636 KB Output is correct
40 Correct 2 ms 2636 KB Output is correct
41 Correct 2 ms 2636 KB Output is correct
42 Correct 3 ms 2636 KB Output is correct
43 Correct 3 ms 2636 KB Output is correct
44 Correct 2 ms 2636 KB Output is correct
45 Correct 2 ms 2636 KB Output is correct
46 Correct 2 ms 2636 KB Output is correct
47 Correct 3 ms 2588 KB Output is correct
48 Correct 2 ms 2636 KB Output is correct
49 Correct 2 ms 2636 KB Output is correct
50 Correct 4 ms 2708 KB Output is correct
51 Correct 4 ms 2636 KB Output is correct
52 Correct 4 ms 2636 KB Output is correct
53 Correct 3 ms 2636 KB Output is correct
54 Correct 4 ms 2636 KB Output is correct
55 Correct 5 ms 2764 KB Output is correct
56 Correct 5 ms 2636 KB Output is correct
57 Correct 5 ms 2636 KB Output is correct
58 Correct 3 ms 2556 KB Output is correct
59 Correct 3 ms 2636 KB Output is correct
60 Correct 2 ms 2636 KB Output is correct
61 Correct 3 ms 2636 KB Output is correct
62 Correct 3 ms 2636 KB Output is correct
63 Correct 2 ms 2636 KB Output is correct
64 Correct 2 ms 2636 KB Output is correct
65 Correct 3 ms 2636 KB Output is correct
66 Correct 2 ms 2636 KB Output is correct
67 Correct 2 ms 2636 KB Output is correct
68 Correct 2 ms 2636 KB Output is correct
69 Correct 3 ms 2636 KB Output is correct
70 Correct 3 ms 2636 KB Output is correct
71 Correct 213 ms 7476 KB Output is correct
72 Correct 148 ms 6768 KB Output is correct
73 Correct 204 ms 7200 KB Output is correct
74 Correct 113 ms 5224 KB Output is correct
75 Correct 137 ms 5100 KB Output is correct
76 Correct 331 ms 8628 KB Output is correct
77 Correct 300 ms 8048 KB Output is correct
78 Correct 262 ms 7760 KB Output is correct
79 Correct 255 ms 7924 KB Output is correct
80 Correct 2 ms 2636 KB Output is correct
81 Correct 2 ms 2636 KB Output is correct
82 Correct 4 ms 2636 KB Output is correct
83 Correct 30 ms 3476 KB Output is correct
84 Correct 39 ms 3704 KB Output is correct
85 Correct 10 ms 2988 KB Output is correct
86 Correct 2 ms 2636 KB Output is correct
87 Correct 42 ms 3808 KB Output is correct
88 Correct 2 ms 2636 KB Output is correct
89 Correct 2 ms 2636 KB Output is correct
90 Correct 2 ms 2636 KB Output is correct
91 Correct 13 ms 3008 KB Output is correct
92 Correct 59 ms 4104 KB Output is correct
93 Correct 1172 ms 22600 KB Output is correct
94 Correct 639 ms 15024 KB Output is correct
95 Correct 756 ms 19028 KB Output is correct
96 Correct 718 ms 14396 KB Output is correct
97 Correct 634 ms 13764 KB Output is correct
98 Correct 1390 ms 24784 KB Output is correct
99 Correct 1464 ms 24400 KB Output is correct
100 Correct 1280 ms 24224 KB Output is correct
101 Correct 1263 ms 23524 KB Output is correct
102 Correct 1073 ms 21736 KB Output is correct
103 Correct 850 ms 20376 KB Output is correct
104 Correct 2 ms 2636 KB Output is correct
105 Correct 2 ms 2636 KB Output is correct
106 Correct 6 ms 2764 KB Output is correct
107 Correct 96 ms 4948 KB Output is correct
108 Correct 234 ms 7616 KB Output is correct
109 Correct 22 ms 3316 KB Output is correct
110 Correct 2 ms 2636 KB Output is correct
111 Correct 122 ms 5596 KB Output is correct
112 Correct 2 ms 2636 KB Output is correct
113 Correct 2 ms 2636 KB Output is correct
114 Correct 6 ms 2764 KB Output is correct
115 Correct 2 ms 2636 KB Output is correct
116 Correct 11 ms 2960 KB Output is correct
117 Correct 233 ms 7676 KB Output is correct