Submission #746481

# Submission time Handle Problem Language Result Execution time Memory
746481 2023-05-22T13:43:08 Z vjudge1 Toys (CEOI18_toy) C++17
79 / 100
5000 ms 11688 KB
#include <bits/stdc++.h>
using namespace std;

const int SQ = 1e5;
vector<int> vec;
vector<int> ans[SQ];
int n , sz;

void cal(int n){
	for(int i = 1 ; i * i <= n ; i++){
		if(n % i) continue;
		vec.push_back(i);
		if(i * i != n) vec.push_back(n / i);
	}
}

int main(){
	ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
	ans[0].push_back(0);
	cin >> n;
	cal(n);
	sort(vec.begin() , vec.end());
	sz = (int)vec.size();
	for(int i = 1 ; i < sz ; i++){
		for(int j = 0 ; j < i ; j++){
			if(vec[i] % vec[j]) continue;
			for(int k : ans[j]) ans[i].push_back(vec[i] / vec[j] + k - 1);
			sort(ans[i].begin() , ans[i].end());
			ans[i].resize(unique(ans[i].begin() , ans[i].end()) - ans[i].begin());
		}
	}
	cout << (int)ans[sz - 1].size() << '\n';
	for(int k : ans[sz - 1])
		cout << k << ' ';
	cout << '\n';
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2596 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 1 ms 2644 KB Output is correct
14 Correct 1 ms 2644 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 1 ms 2644 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 1 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2596 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 1 ms 2644 KB Output is correct
14 Correct 1 ms 2644 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 1 ms 2644 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 1 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 1 ms 2644 KB Output is correct
30 Correct 1 ms 2644 KB Output is correct
31 Correct 2 ms 2644 KB Output is correct
32 Correct 2 ms 2644 KB Output is correct
33 Correct 2 ms 2644 KB Output is correct
34 Correct 2 ms 2644 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 1 ms 2644 KB Output is correct
37 Correct 2 ms 2644 KB Output is correct
38 Correct 1 ms 2644 KB Output is correct
39 Correct 2 ms 2644 KB Output is correct
40 Correct 2 ms 2644 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 1 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 1 ms 2644 KB Output is correct
49 Correct 2 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2596 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 1 ms 2644 KB Output is correct
14 Correct 1 ms 2644 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 1 ms 2644 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 1 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 1 ms 2644 KB Output is correct
30 Correct 1 ms 2644 KB Output is correct
31 Correct 2 ms 2644 KB Output is correct
32 Correct 2 ms 2644 KB Output is correct
33 Correct 2 ms 2644 KB Output is correct
34 Correct 2 ms 2644 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 1 ms 2644 KB Output is correct
37 Correct 2 ms 2644 KB Output is correct
38 Correct 1 ms 2644 KB Output is correct
39 Correct 2 ms 2644 KB Output is correct
40 Correct 2 ms 2644 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 1 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 1 ms 2644 KB Output is correct
49 Correct 2 ms 2644 KB Output is correct
50 Correct 6 ms 2644 KB Output is correct
51 Correct 5 ms 2644 KB Output is correct
52 Correct 5 ms 2644 KB Output is correct
53 Correct 4 ms 2644 KB Output is correct
54 Correct 3 ms 2644 KB Output is correct
55 Correct 7 ms 2728 KB Output is correct
56 Correct 7 ms 2644 KB Output is correct
57 Correct 6 ms 2644 KB Output is correct
58 Correct 1 ms 2644 KB Output is correct
59 Correct 1 ms 2644 KB Output is correct
60 Correct 2 ms 2644 KB Output is correct
61 Correct 3 ms 2644 KB Output is correct
62 Correct 2 ms 2644 KB Output is correct
63 Correct 2 ms 2644 KB Output is correct
64 Correct 2 ms 2644 KB Output is correct
65 Correct 5 ms 2652 KB Output is correct
66 Correct 2 ms 2644 KB Output is correct
67 Correct 2 ms 2644 KB Output is correct
68 Correct 2 ms 2644 KB Output is correct
69 Correct 2 ms 2644 KB Output is correct
70 Correct 3 ms 2644 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2596 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 1 ms 2644 KB Output is correct
14 Correct 1 ms 2644 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 1 ms 2644 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 1 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 1 ms 2644 KB Output is correct
30 Correct 1 ms 2644 KB Output is correct
31 Correct 2 ms 2644 KB Output is correct
32 Correct 2 ms 2644 KB Output is correct
33 Correct 2 ms 2644 KB Output is correct
34 Correct 2 ms 2644 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 1 ms 2644 KB Output is correct
37 Correct 2 ms 2644 KB Output is correct
38 Correct 1 ms 2644 KB Output is correct
39 Correct 2 ms 2644 KB Output is correct
40 Correct 2 ms 2644 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 1 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 1 ms 2644 KB Output is correct
49 Correct 2 ms 2644 KB Output is correct
50 Correct 6 ms 2644 KB Output is correct
51 Correct 5 ms 2644 KB Output is correct
52 Correct 5 ms 2644 KB Output is correct
53 Correct 4 ms 2644 KB Output is correct
54 Correct 3 ms 2644 KB Output is correct
55 Correct 7 ms 2728 KB Output is correct
56 Correct 7 ms 2644 KB Output is correct
57 Correct 6 ms 2644 KB Output is correct
58 Correct 1 ms 2644 KB Output is correct
59 Correct 1 ms 2644 KB Output is correct
60 Correct 2 ms 2644 KB Output is correct
61 Correct 3 ms 2644 KB Output is correct
62 Correct 2 ms 2644 KB Output is correct
63 Correct 2 ms 2644 KB Output is correct
64 Correct 2 ms 2644 KB Output is correct
65 Correct 5 ms 2652 KB Output is correct
66 Correct 2 ms 2644 KB Output is correct
67 Correct 2 ms 2644 KB Output is correct
68 Correct 2 ms 2644 KB Output is correct
69 Correct 2 ms 2644 KB Output is correct
70 Correct 3 ms 2644 KB Output is correct
71 Correct 1765 ms 6044 KB Output is correct
72 Correct 1200 ms 5268 KB Output is correct
73 Correct 1564 ms 5596 KB Output is correct
74 Correct 882 ms 4640 KB Output is correct
75 Correct 892 ms 4912 KB Output is correct
76 Correct 2739 ms 6964 KB Output is correct
77 Correct 2157 ms 6460 KB Output is correct
78 Correct 2033 ms 6356 KB Output is correct
79 Correct 1906 ms 6404 KB Output is correct
80 Correct 2 ms 2644 KB Output is correct
81 Correct 3 ms 2772 KB Output is correct
82 Correct 5 ms 2644 KB Output is correct
83 Correct 97 ms 3224 KB Output is correct
84 Correct 171 ms 3408 KB Output is correct
85 Correct 20 ms 2900 KB Output is correct
86 Correct 2 ms 2644 KB Output is correct
87 Correct 160 ms 3540 KB Output is correct
88 Correct 2 ms 2676 KB Output is correct
89 Correct 2 ms 2668 KB Output is correct
90 Correct 2 ms 2664 KB Output is correct
91 Correct 53 ms 2944 KB Output is correct
92 Correct 345 ms 3724 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 2596 KB Output is correct
2 Correct 2 ms 2644 KB Output is correct
3 Correct 2 ms 2644 KB Output is correct
4 Correct 2 ms 2644 KB Output is correct
5 Correct 2 ms 2644 KB Output is correct
6 Correct 2 ms 2644 KB Output is correct
7 Correct 2 ms 2644 KB Output is correct
8 Correct 1 ms 2644 KB Output is correct
9 Correct 2 ms 2644 KB Output is correct
10 Correct 2 ms 2644 KB Output is correct
11 Correct 1 ms 2644 KB Output is correct
12 Correct 1 ms 2644 KB Output is correct
13 Correct 1 ms 2644 KB Output is correct
14 Correct 1 ms 2644 KB Output is correct
15 Correct 1 ms 2644 KB Output is correct
16 Correct 1 ms 2644 KB Output is correct
17 Correct 2 ms 2644 KB Output is correct
18 Correct 1 ms 2644 KB Output is correct
19 Correct 1 ms 2644 KB Output is correct
20 Correct 2 ms 2644 KB Output is correct
21 Correct 2 ms 2644 KB Output is correct
22 Correct 2 ms 2644 KB Output is correct
23 Correct 1 ms 2644 KB Output is correct
24 Correct 2 ms 2644 KB Output is correct
25 Correct 2 ms 2644 KB Output is correct
26 Correct 2 ms 2644 KB Output is correct
27 Correct 2 ms 2644 KB Output is correct
28 Correct 2 ms 2644 KB Output is correct
29 Correct 1 ms 2644 KB Output is correct
30 Correct 1 ms 2644 KB Output is correct
31 Correct 2 ms 2644 KB Output is correct
32 Correct 2 ms 2644 KB Output is correct
33 Correct 2 ms 2644 KB Output is correct
34 Correct 2 ms 2644 KB Output is correct
35 Correct 2 ms 2644 KB Output is correct
36 Correct 1 ms 2644 KB Output is correct
37 Correct 2 ms 2644 KB Output is correct
38 Correct 1 ms 2644 KB Output is correct
39 Correct 2 ms 2644 KB Output is correct
40 Correct 2 ms 2644 KB Output is correct
41 Correct 1 ms 2644 KB Output is correct
42 Correct 1 ms 2644 KB Output is correct
43 Correct 1 ms 2644 KB Output is correct
44 Correct 2 ms 2644 KB Output is correct
45 Correct 2 ms 2644 KB Output is correct
46 Correct 2 ms 2644 KB Output is correct
47 Correct 2 ms 2644 KB Output is correct
48 Correct 1 ms 2644 KB Output is correct
49 Correct 2 ms 2644 KB Output is correct
50 Correct 6 ms 2644 KB Output is correct
51 Correct 5 ms 2644 KB Output is correct
52 Correct 5 ms 2644 KB Output is correct
53 Correct 4 ms 2644 KB Output is correct
54 Correct 3 ms 2644 KB Output is correct
55 Correct 7 ms 2728 KB Output is correct
56 Correct 7 ms 2644 KB Output is correct
57 Correct 6 ms 2644 KB Output is correct
58 Correct 1 ms 2644 KB Output is correct
59 Correct 1 ms 2644 KB Output is correct
60 Correct 2 ms 2644 KB Output is correct
61 Correct 3 ms 2644 KB Output is correct
62 Correct 2 ms 2644 KB Output is correct
63 Correct 2 ms 2644 KB Output is correct
64 Correct 2 ms 2644 KB Output is correct
65 Correct 5 ms 2652 KB Output is correct
66 Correct 2 ms 2644 KB Output is correct
67 Correct 2 ms 2644 KB Output is correct
68 Correct 2 ms 2644 KB Output is correct
69 Correct 2 ms 2644 KB Output is correct
70 Correct 3 ms 2644 KB Output is correct
71 Correct 1765 ms 6044 KB Output is correct
72 Correct 1200 ms 5268 KB Output is correct
73 Correct 1564 ms 5596 KB Output is correct
74 Correct 882 ms 4640 KB Output is correct
75 Correct 892 ms 4912 KB Output is correct
76 Correct 2739 ms 6964 KB Output is correct
77 Correct 2157 ms 6460 KB Output is correct
78 Correct 2033 ms 6356 KB Output is correct
79 Correct 1906 ms 6404 KB Output is correct
80 Correct 2 ms 2644 KB Output is correct
81 Correct 3 ms 2772 KB Output is correct
82 Correct 5 ms 2644 KB Output is correct
83 Correct 97 ms 3224 KB Output is correct
84 Correct 171 ms 3408 KB Output is correct
85 Correct 20 ms 2900 KB Output is correct
86 Correct 2 ms 2644 KB Output is correct
87 Correct 160 ms 3540 KB Output is correct
88 Correct 2 ms 2676 KB Output is correct
89 Correct 2 ms 2668 KB Output is correct
90 Correct 2 ms 2664 KB Output is correct
91 Correct 53 ms 2944 KB Output is correct
92 Correct 345 ms 3724 KB Output is correct
93 Execution timed out 5012 ms 11688 KB Time limit exceeded
94 Halted 0 ms 0 KB -