답안 #594828

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
594828 2022-07-13T02:56:17 Z penguinhacker Toys (CEOI18_toy) C++17
100 / 100
1742 ms 86968 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define ar array

int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	vector<int> f;
	for (int i=1; i*i<=n; ++i) {
		if (n%i==0) {
			f.push_back(i);
			if (i*i<n)
				f.push_back(n/i);
		}
	}
	sort(f.begin(), f.end());
	set<int> dp[f.size()];
	dp[0]={0};
	for (int i=1; i<f.size(); ++i) {
		dp[i]={f[i]-1};
		for (int j=1; j<i; ++j)
			if (f[i]%f[j]==0) {
				int pos=lower_bound(f.begin(), f.end(), f[i]/f[j])-f.begin();
				for (int x : dp[pos])
					dp[i].insert(x+f[j]-1);
			}
		//cout << f[i] << endl;
	}
	vector<int> ans(dp[f.size()-1].begin(), dp[f.size()-1].end());
	cout << ans.size() << "\n";
	for (int i : ans)
		cout << i << " ";
	return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:23:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |  for (int i=1; i<f.size(); ++i) {
      |                ~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 316 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 316 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 0 ms 324 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 316 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 316 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 0 ms 324 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 3 ms 520 KB Output is correct
51 Correct 2 ms 580 KB Output is correct
52 Correct 2 ms 572 KB Output is correct
53 Correct 2 ms 448 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 3 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 580 KB Output is correct
58 Correct 1 ms 324 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 316 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 316 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 316 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 0 ms 324 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 3 ms 520 KB Output is correct
51 Correct 2 ms 580 KB Output is correct
52 Correct 2 ms 572 KB Output is correct
53 Correct 2 ms 448 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 3 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 580 KB Output is correct
58 Correct 1 ms 324 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 316 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 262 ms 18544 KB Output is correct
72 Correct 168 ms 14004 KB Output is correct
73 Correct 227 ms 16416 KB Output is correct
74 Correct 132 ms 11108 KB Output is correct
75 Correct 142 ms 11844 KB Output is correct
76 Correct 404 ms 24912 KB Output is correct
77 Correct 384 ms 21976 KB Output is correct
78 Correct 308 ms 20676 KB Output is correct
79 Correct 328 ms 20140 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 31 ms 3576 KB Output is correct
84 Correct 42 ms 4300 KB Output is correct
85 Correct 10 ms 1464 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 48 ms 4896 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 13 ms 2044 KB Output is correct
92 Correct 60 ms 6472 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 1 ms 248 KB Output is correct
12 Correct 0 ms 316 KB Output is correct
13 Correct 0 ms 324 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 320 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 316 KB Output is correct
26 Correct 2 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 1 ms 316 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 312 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 340 KB Output is correct
39 Correct 0 ms 324 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 1 ms 212 KB Output is correct
49 Correct 1 ms 340 KB Output is correct
50 Correct 3 ms 520 KB Output is correct
51 Correct 2 ms 580 KB Output is correct
52 Correct 2 ms 572 KB Output is correct
53 Correct 2 ms 448 KB Output is correct
54 Correct 1 ms 340 KB Output is correct
55 Correct 3 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 580 KB Output is correct
58 Correct 1 ms 324 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 316 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 0 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 262 ms 18544 KB Output is correct
72 Correct 168 ms 14004 KB Output is correct
73 Correct 227 ms 16416 KB Output is correct
74 Correct 132 ms 11108 KB Output is correct
75 Correct 142 ms 11844 KB Output is correct
76 Correct 404 ms 24912 KB Output is correct
77 Correct 384 ms 21976 KB Output is correct
78 Correct 308 ms 20676 KB Output is correct
79 Correct 328 ms 20140 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 31 ms 3576 KB Output is correct
84 Correct 42 ms 4300 KB Output is correct
85 Correct 10 ms 1464 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 48 ms 4896 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 13 ms 2044 KB Output is correct
92 Correct 60 ms 6472 KB Output is correct
93 Correct 1480 ms 77460 KB Output is correct
94 Correct 817 ms 52236 KB Output is correct
95 Correct 923 ms 54824 KB Output is correct
96 Correct 796 ms 48940 KB Output is correct
97 Correct 800 ms 44548 KB Output is correct
98 Correct 1711 ms 85432 KB Output is correct
99 Correct 1742 ms 86968 KB Output is correct
100 Correct 1618 ms 83620 KB Output is correct
101 Correct 1551 ms 77352 KB Output is correct
102 Correct 1364 ms 69532 KB Output is correct
103 Correct 1085 ms 62524 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 5 ms 852 KB Output is correct
107 Correct 115 ms 9532 KB Output is correct
108 Correct 292 ms 20360 KB Output is correct
109 Correct 24 ms 3156 KB Output is correct
110 Correct 1 ms 212 KB Output is correct
111 Correct 165 ms 12244 KB Output is correct
112 Correct 1 ms 340 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 5 ms 852 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 10 ms 1620 KB Output is correct
117 Correct 297 ms 24668 KB Output is correct