답안 #113321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113321 2019-05-25T02:51:26 Z Diuven Toys (CEOI18_toy) C++14
100 / 100
3119 ms 17232 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long lint;
typedef pair<int, int> pii;

const int INF = 2e9;
const int MOD = 1e9+7;
const int MAX = 1e5+10;
const lint LNF = 2e18;

vector<int> ans;
int n;

void solve(int x, int m, int sum){
	if(m==1){ ans.push_back(sum); return; }
	for(lint d=1; d*d<=m; d++){
		if(m%d==0 && d>=x) solve(d, m/d, sum+d-1);
		if(m%d==0 && m/d>=x) solve(m/d, d, sum+m/d-1);
	}
}

int main(){
	ios::sync_with_stdio(0); cin.tie(0);

	cin>>n;

	solve(2, n, 0);

	sort(ans.begin(), ans.end());
	ans.resize(unique(ans.begin(), ans.end())-ans.begin());
	cout<<ans.size()<<'\n';
	for(int x:ans) cout<<x<<' ';
	cout<<'\n';

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 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 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 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 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 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
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 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 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 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 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 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 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 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 300 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 384 KB Output is correct
47 Correct 3 ms 384 KB Output is correct
48 Correct 2 ms 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 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 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 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 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 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 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 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 300 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 384 KB Output is correct
47 Correct 3 ms 384 KB Output is correct
48 Correct 2 ms 384 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 384 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 3 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 384 KB Output is correct
60 Correct 3 ms 384 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 2 ms 384 KB Output is correct
64 Correct 4 ms 384 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 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 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 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 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 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 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 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 300 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 384 KB Output is correct
47 Correct 3 ms 384 KB Output is correct
48 Correct 2 ms 384 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 384 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 3 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 384 KB Output is correct
60 Correct 3 ms 384 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 2 ms 384 KB Output is correct
64 Correct 4 ms 384 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 242 ms 2544 KB Output is correct
72 Correct 153 ms 1556 KB Output is correct
73 Correct 253 ms 2604 KB Output is correct
74 Correct 110 ms 1056 KB Output is correct
75 Correct 150 ms 1496 KB Output is correct
76 Correct 504 ms 4596 KB Output is correct
77 Correct 545 ms 4584 KB Output is correct
78 Correct 371 ms 2592 KB Output is correct
79 Correct 385 ms 2668 KB Output is correct
80 Correct 2 ms 384 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 5 ms 384 KB Output is correct
83 Correct 42 ms 760 KB Output is correct
84 Correct 43 ms 692 KB Output is correct
85 Correct 12 ms 512 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 52 ms 764 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 17 ms 512 KB Output is correct
92 Correct 52 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 384 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 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 384 KB Output is correct
9 Correct 2 ms 384 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 384 KB Output is correct
16 Correct 2 ms 384 KB Output is correct
17 Correct 2 ms 384 KB Output is correct
18 Correct 2 ms 384 KB Output is correct
19 Correct 2 ms 384 KB Output is correct
20 Correct 2 ms 384 KB Output is correct
21 Correct 2 ms 384 KB Output is correct
22 Correct 2 ms 384 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 384 KB Output is correct
35 Correct 2 ms 384 KB Output is correct
36 Correct 2 ms 384 KB Output is correct
37 Correct 2 ms 384 KB Output is correct
38 Correct 2 ms 384 KB Output is correct
39 Correct 2 ms 384 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 300 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 384 KB Output is correct
47 Correct 3 ms 384 KB Output is correct
48 Correct 2 ms 384 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 384 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 3 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 384 KB Output is correct
60 Correct 3 ms 384 KB Output is correct
61 Correct 3 ms 384 KB Output is correct
62 Correct 2 ms 384 KB Output is correct
63 Correct 2 ms 384 KB Output is correct
64 Correct 4 ms 384 KB Output is correct
65 Correct 3 ms 384 KB Output is correct
66 Correct 2 ms 384 KB Output is correct
67 Correct 2 ms 384 KB Output is correct
68 Correct 2 ms 384 KB Output is correct
69 Correct 2 ms 384 KB Output is correct
70 Correct 2 ms 384 KB Output is correct
71 Correct 242 ms 2544 KB Output is correct
72 Correct 153 ms 1556 KB Output is correct
73 Correct 253 ms 2604 KB Output is correct
74 Correct 110 ms 1056 KB Output is correct
75 Correct 150 ms 1496 KB Output is correct
76 Correct 504 ms 4596 KB Output is correct
77 Correct 545 ms 4584 KB Output is correct
78 Correct 371 ms 2592 KB Output is correct
79 Correct 385 ms 2668 KB Output is correct
80 Correct 2 ms 384 KB Output is correct
81 Correct 2 ms 384 KB Output is correct
82 Correct 5 ms 384 KB Output is correct
83 Correct 42 ms 760 KB Output is correct
84 Correct 43 ms 692 KB Output is correct
85 Correct 12 ms 512 KB Output is correct
86 Correct 2 ms 384 KB Output is correct
87 Correct 52 ms 764 KB Output is correct
88 Correct 2 ms 384 KB Output is correct
89 Correct 2 ms 384 KB Output is correct
90 Correct 3 ms 384 KB Output is correct
91 Correct 17 ms 512 KB Output is correct
92 Correct 52 ms 760 KB Output is correct
93 Correct 2152 ms 9040 KB Output is correct
94 Correct 946 ms 4776 KB Output is correct
95 Correct 1237 ms 8712 KB Output is correct
96 Correct 1028 ms 5124 KB Output is correct
97 Correct 989 ms 4672 KB Output is correct
98 Correct 2710 ms 17108 KB Output is correct
99 Correct 3119 ms 17232 KB Output is correct
100 Correct 2612 ms 17220 KB Output is correct
101 Correct 3079 ms 17160 KB Output is correct
102 Correct 2652 ms 16936 KB Output is correct
103 Correct 1511 ms 8800 KB Output is correct
104 Correct 2 ms 384 KB Output is correct
105 Correct 2 ms 384 KB Output is correct
106 Correct 9 ms 384 KB Output is correct
107 Correct 204 ms 1680 KB Output is correct
108 Correct 462 ms 2548 KB Output is correct
109 Correct 38 ms 632 KB Output is correct
110 Correct 3 ms 432 KB Output is correct
111 Correct 205 ms 1460 KB Output is correct
112 Correct 3 ms 384 KB Output is correct
113 Correct 3 ms 384 KB Output is correct
114 Correct 13 ms 384 KB Output is correct
115 Correct 3 ms 384 KB Output is correct
116 Correct 32 ms 504 KB Output is correct
117 Correct 291 ms 1492 KB Output is correct