Submission #70527

# Submission time Handle Problem Language Result Execution time Memory
70527 2018-08-23T05:14:48 Z 조승현(#2190) Toys (CEOI18_toy) C++11
100 / 100
872 ms 17304 KB
#include<cstdio>
#include<algorithm>
#include<vector>
using namespace std;
vector<int>T;
void Calc(int a, int b, int s) {
	if (a == 1) {
		T.push_back(s);
		return;
	}
	if (1ll*b*b <= a) {
		for (int i = b; i >= 2; i--) {
			if (a%i == 0) {
				Calc(a / i, i, s+i-1);
			}
		}
	}
	else {
		for (int i = 1; i*i <= a; i++) {
			if (a%i == 0 && a/i<=b) {
				Calc(i, a / i, s + a / i - 1);
			}
		}
		for (int i = 1; i*i < a; i++) {
			if (a%i == 0) {
				Calc(a / i, i, s + i - 1);
			}
		}
	}
}
int main() {
	int n;
	scanf("%d", &n);
	if (n == 1) {
		printf("1\n0\n");
		return 0;
	}
	Calc(n,n,0);
	sort(T.begin(), T.end());
	T.resize(unique(T.begin(), T.end()) - T.begin());
	printf("%d\n", T.size());
	for (auto &x : T)printf("%d ", x);
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:41:25: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
  printf("%d\n", T.size());
                 ~~~~~~~~^
toy.cpp:33:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d", &n);
  ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 3 ms 480 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 3 ms 516 KB Output is correct
8 Correct 3 ms 516 KB Output is correct
9 Correct 3 ms 516 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 568 KB Output is correct
12 Correct 3 ms 568 KB Output is correct
13 Correct 2 ms 568 KB Output is correct
14 Correct 2 ms 568 KB Output is correct
15 Correct 3 ms 568 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 3 ms 480 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 3 ms 516 KB Output is correct
8 Correct 3 ms 516 KB Output is correct
9 Correct 3 ms 516 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 568 KB Output is correct
12 Correct 3 ms 568 KB Output is correct
13 Correct 2 ms 568 KB Output is correct
14 Correct 2 ms 568 KB Output is correct
15 Correct 3 ms 568 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 600 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 2 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 3 ms 600 KB Output is correct
38 Correct 3 ms 600 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 3 ms 600 KB Output is correct
41 Correct 2 ms 600 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 3 ms 600 KB Output is correct
44 Correct 2 ms 600 KB Output is correct
45 Correct 2 ms 600 KB Output is correct
46 Correct 2 ms 600 KB Output is correct
47 Correct 2 ms 600 KB Output is correct
48 Correct 2 ms 600 KB Output is correct
49 Correct 2 ms 600 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 3 ms 480 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 3 ms 516 KB Output is correct
8 Correct 3 ms 516 KB Output is correct
9 Correct 3 ms 516 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 568 KB Output is correct
12 Correct 3 ms 568 KB Output is correct
13 Correct 2 ms 568 KB Output is correct
14 Correct 2 ms 568 KB Output is correct
15 Correct 3 ms 568 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 600 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 2 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 3 ms 600 KB Output is correct
38 Correct 3 ms 600 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 3 ms 600 KB Output is correct
41 Correct 2 ms 600 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 3 ms 600 KB Output is correct
44 Correct 2 ms 600 KB Output is correct
45 Correct 2 ms 600 KB Output is correct
46 Correct 2 ms 600 KB Output is correct
47 Correct 2 ms 600 KB Output is correct
48 Correct 2 ms 600 KB Output is correct
49 Correct 2 ms 600 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 3 ms 600 KB Output is correct
52 Correct 3 ms 612 KB Output is correct
53 Correct 4 ms 612 KB Output is correct
54 Correct 2 ms 612 KB Output is correct
55 Correct 3 ms 612 KB Output is correct
56 Correct 4 ms 612 KB Output is correct
57 Correct 3 ms 736 KB Output is correct
58 Correct 3 ms 736 KB Output is correct
59 Correct 3 ms 736 KB Output is correct
60 Correct 3 ms 736 KB Output is correct
61 Correct 3 ms 736 KB Output is correct
62 Correct 3 ms 736 KB Output is correct
63 Correct 3 ms 736 KB Output is correct
64 Correct 3 ms 736 KB Output is correct
65 Correct 2 ms 736 KB Output is correct
66 Correct 2 ms 736 KB Output is correct
67 Correct 2 ms 736 KB Output is correct
68 Correct 2 ms 736 KB Output is correct
69 Correct 2 ms 736 KB Output is correct
70 Correct 4 ms 736 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 3 ms 480 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 3 ms 516 KB Output is correct
8 Correct 3 ms 516 KB Output is correct
9 Correct 3 ms 516 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 568 KB Output is correct
12 Correct 3 ms 568 KB Output is correct
13 Correct 2 ms 568 KB Output is correct
14 Correct 2 ms 568 KB Output is correct
15 Correct 3 ms 568 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 600 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 2 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 3 ms 600 KB Output is correct
38 Correct 3 ms 600 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 3 ms 600 KB Output is correct
41 Correct 2 ms 600 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 3 ms 600 KB Output is correct
44 Correct 2 ms 600 KB Output is correct
45 Correct 2 ms 600 KB Output is correct
46 Correct 2 ms 600 KB Output is correct
47 Correct 2 ms 600 KB Output is correct
48 Correct 2 ms 600 KB Output is correct
49 Correct 2 ms 600 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 3 ms 600 KB Output is correct
52 Correct 3 ms 612 KB Output is correct
53 Correct 4 ms 612 KB Output is correct
54 Correct 2 ms 612 KB Output is correct
55 Correct 3 ms 612 KB Output is correct
56 Correct 4 ms 612 KB Output is correct
57 Correct 3 ms 736 KB Output is correct
58 Correct 3 ms 736 KB Output is correct
59 Correct 3 ms 736 KB Output is correct
60 Correct 3 ms 736 KB Output is correct
61 Correct 3 ms 736 KB Output is correct
62 Correct 3 ms 736 KB Output is correct
63 Correct 3 ms 736 KB Output is correct
64 Correct 3 ms 736 KB Output is correct
65 Correct 2 ms 736 KB Output is correct
66 Correct 2 ms 736 KB Output is correct
67 Correct 2 ms 736 KB Output is correct
68 Correct 2 ms 736 KB Output is correct
69 Correct 2 ms 736 KB Output is correct
70 Correct 4 ms 736 KB Output is correct
71 Correct 79 ms 2776 KB Output is correct
72 Correct 52 ms 2776 KB Output is correct
73 Correct 86 ms 2792 KB Output is correct
74 Correct 37 ms 2792 KB Output is correct
75 Correct 52 ms 2792 KB Output is correct
76 Correct 150 ms 4864 KB Output is correct
77 Correct 215 ms 4864 KB Output is correct
78 Correct 117 ms 4864 KB Output is correct
79 Correct 111 ms 4864 KB Output is correct
80 Correct 3 ms 4864 KB Output is correct
81 Correct 2 ms 4864 KB Output is correct
82 Correct 2 ms 4864 KB Output is correct
83 Correct 13 ms 4864 KB Output is correct
84 Correct 17 ms 4864 KB Output is correct
85 Correct 4 ms 4864 KB Output is correct
86 Correct 4 ms 4864 KB Output is correct
87 Correct 14 ms 4864 KB Output is correct
88 Correct 2 ms 4864 KB Output is correct
89 Correct 2 ms 4864 KB Output is correct
90 Correct 3 ms 4864 KB Output is correct
91 Correct 6 ms 4864 KB Output is correct
92 Correct 19 ms 4864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 248 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 3 ms 356 KB Output is correct
4 Correct 3 ms 432 KB Output is correct
5 Correct 3 ms 480 KB Output is correct
6 Correct 2 ms 516 KB Output is correct
7 Correct 3 ms 516 KB Output is correct
8 Correct 3 ms 516 KB Output is correct
9 Correct 3 ms 516 KB Output is correct
10 Correct 2 ms 568 KB Output is correct
11 Correct 2 ms 568 KB Output is correct
12 Correct 3 ms 568 KB Output is correct
13 Correct 2 ms 568 KB Output is correct
14 Correct 2 ms 568 KB Output is correct
15 Correct 3 ms 568 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 3 ms 600 KB Output is correct
18 Correct 4 ms 600 KB Output is correct
19 Correct 2 ms 600 KB Output is correct
20 Correct 2 ms 600 KB Output is correct
21 Correct 2 ms 600 KB Output is correct
22 Correct 3 ms 600 KB Output is correct
23 Correct 2 ms 600 KB Output is correct
24 Correct 2 ms 600 KB Output is correct
25 Correct 2 ms 600 KB Output is correct
26 Correct 2 ms 600 KB Output is correct
27 Correct 2 ms 600 KB Output is correct
28 Correct 3 ms 600 KB Output is correct
29 Correct 3 ms 600 KB Output is correct
30 Correct 2 ms 600 KB Output is correct
31 Correct 2 ms 600 KB Output is correct
32 Correct 2 ms 600 KB Output is correct
33 Correct 2 ms 600 KB Output is correct
34 Correct 2 ms 600 KB Output is correct
35 Correct 2 ms 600 KB Output is correct
36 Correct 2 ms 600 KB Output is correct
37 Correct 3 ms 600 KB Output is correct
38 Correct 3 ms 600 KB Output is correct
39 Correct 2 ms 600 KB Output is correct
40 Correct 3 ms 600 KB Output is correct
41 Correct 2 ms 600 KB Output is correct
42 Correct 2 ms 600 KB Output is correct
43 Correct 3 ms 600 KB Output is correct
44 Correct 2 ms 600 KB Output is correct
45 Correct 2 ms 600 KB Output is correct
46 Correct 2 ms 600 KB Output is correct
47 Correct 2 ms 600 KB Output is correct
48 Correct 2 ms 600 KB Output is correct
49 Correct 2 ms 600 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 3 ms 600 KB Output is correct
52 Correct 3 ms 612 KB Output is correct
53 Correct 4 ms 612 KB Output is correct
54 Correct 2 ms 612 KB Output is correct
55 Correct 3 ms 612 KB Output is correct
56 Correct 4 ms 612 KB Output is correct
57 Correct 3 ms 736 KB Output is correct
58 Correct 3 ms 736 KB Output is correct
59 Correct 3 ms 736 KB Output is correct
60 Correct 3 ms 736 KB Output is correct
61 Correct 3 ms 736 KB Output is correct
62 Correct 3 ms 736 KB Output is correct
63 Correct 3 ms 736 KB Output is correct
64 Correct 3 ms 736 KB Output is correct
65 Correct 2 ms 736 KB Output is correct
66 Correct 2 ms 736 KB Output is correct
67 Correct 2 ms 736 KB Output is correct
68 Correct 2 ms 736 KB Output is correct
69 Correct 2 ms 736 KB Output is correct
70 Correct 4 ms 736 KB Output is correct
71 Correct 79 ms 2776 KB Output is correct
72 Correct 52 ms 2776 KB Output is correct
73 Correct 86 ms 2792 KB Output is correct
74 Correct 37 ms 2792 KB Output is correct
75 Correct 52 ms 2792 KB Output is correct
76 Correct 150 ms 4864 KB Output is correct
77 Correct 215 ms 4864 KB Output is correct
78 Correct 117 ms 4864 KB Output is correct
79 Correct 111 ms 4864 KB Output is correct
80 Correct 3 ms 4864 KB Output is correct
81 Correct 2 ms 4864 KB Output is correct
82 Correct 2 ms 4864 KB Output is correct
83 Correct 13 ms 4864 KB Output is correct
84 Correct 17 ms 4864 KB Output is correct
85 Correct 4 ms 4864 KB Output is correct
86 Correct 4 ms 4864 KB Output is correct
87 Correct 14 ms 4864 KB Output is correct
88 Correct 2 ms 4864 KB Output is correct
89 Correct 2 ms 4864 KB Output is correct
90 Correct 3 ms 4864 KB Output is correct
91 Correct 6 ms 4864 KB Output is correct
92 Correct 19 ms 4864 KB Output is correct
93 Correct 527 ms 9240 KB Output is correct
94 Correct 272 ms 9240 KB Output is correct
95 Correct 318 ms 9240 KB Output is correct
96 Correct 290 ms 9240 KB Output is correct
97 Correct 280 ms 9240 KB Output is correct
98 Correct 721 ms 17252 KB Output is correct
99 Correct 872 ms 17252 KB Output is correct
100 Correct 721 ms 17252 KB Output is correct
101 Correct 870 ms 17304 KB Output is correct
102 Correct 667 ms 17304 KB Output is correct
103 Correct 358 ms 17304 KB Output is correct
104 Correct 3 ms 17304 KB Output is correct
105 Correct 4 ms 17304 KB Output is correct
106 Correct 4 ms 17304 KB Output is correct
107 Correct 59 ms 17304 KB Output is correct
108 Correct 115 ms 17304 KB Output is correct
109 Correct 7 ms 17304 KB Output is correct
110 Correct 3 ms 17304 KB Output is correct
111 Correct 38 ms 17304 KB Output is correct
112 Correct 3 ms 17304 KB Output is correct
113 Correct 2 ms 17304 KB Output is correct
114 Correct 4 ms 17304 KB Output is correct
115 Correct 2 ms 17304 KB Output is correct
116 Correct 5 ms 17304 KB Output is correct
117 Correct 81 ms 17304 KB Output is correct