답안 #113322

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
113322 2019-05-25T02:56:27 Z Diuven Toys (CEOI18_toy) C++14
59 / 100
5000 ms 2856 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, D;
int n;

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

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

	cin>>n;
	for(int i=1; i*i<=n; i++) if(n%i==0) D.push_back(i), D.push_back(n/i);
	sort(D.begin(), D.end());

	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 384 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 0 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 380 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 512 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 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 1 ms 384 KB Output is correct
25 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 0 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 380 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 512 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 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 1 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 256 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 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 256 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 3 ms 512 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 256 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 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 0 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 380 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 512 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 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 1 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 256 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 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 256 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 3 ms 512 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 256 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 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 5 ms 384 KB Output is correct
51 Correct 4 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 4 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 8 ms 384 KB Output is correct
56 Correct 7 ms 384 KB Output is correct
57 Correct 6 ms 384 KB Output is correct
58 Correct 2 ms 256 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 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 384 KB Output is correct
64 Correct 2 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 3 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 0 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 380 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 512 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 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 1 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 256 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 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 256 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 3 ms 512 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 256 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 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 5 ms 384 KB Output is correct
51 Correct 4 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 4 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 8 ms 384 KB Output is correct
56 Correct 7 ms 384 KB Output is correct
57 Correct 6 ms 384 KB Output is correct
58 Correct 2 ms 256 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 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 384 KB Output is correct
64 Correct 2 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 3 ms 384 KB Output is correct
71 Correct 2887 ms 2616 KB Output is correct
72 Correct 1677 ms 1668 KB Output is correct
73 Correct 3169 ms 2856 KB Output is correct
74 Correct 1061 ms 1168 KB Output is correct
75 Correct 1493 ms 1816 KB Output is correct
76 Execution timed out 5012 ms 2844 KB Time limit exceeded
77 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 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 0 ms 380 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
8 Correct 2 ms 380 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 512 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 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 1 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 256 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 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 256 KB Output is correct
39 Correct 2 ms 256 KB Output is correct
40 Correct 2 ms 384 KB Output is correct
41 Correct 3 ms 512 KB Output is correct
42 Correct 2 ms 384 KB Output is correct
43 Correct 2 ms 256 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 384 KB Output is correct
49 Correct 2 ms 384 KB Output is correct
50 Correct 5 ms 384 KB Output is correct
51 Correct 4 ms 384 KB Output is correct
52 Correct 5 ms 384 KB Output is correct
53 Correct 4 ms 384 KB Output is correct
54 Correct 3 ms 384 KB Output is correct
55 Correct 8 ms 384 KB Output is correct
56 Correct 7 ms 384 KB Output is correct
57 Correct 6 ms 384 KB Output is correct
58 Correct 2 ms 256 KB Output is correct
59 Correct 2 ms 384 KB Output is correct
60 Correct 2 ms 384 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 384 KB Output is correct
64 Correct 2 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 3 ms 384 KB Output is correct
71 Correct 2887 ms 2616 KB Output is correct
72 Correct 1677 ms 1668 KB Output is correct
73 Correct 3169 ms 2856 KB Output is correct
74 Correct 1061 ms 1168 KB Output is correct
75 Correct 1493 ms 1816 KB Output is correct
76 Execution timed out 5012 ms 2844 KB Time limit exceeded
77 Halted 0 ms 0 KB -