답안 #400992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
400992 2021-05-09T02:34:22 Z KoD Toys (CEOI18_toy) C++17
100 / 100
2989 ms 86668 KB
#include <bits/stdc++.h>

template <class T>
using Vec = std::vector<T>;

using ll = long long;

int main() {
    int N;
    std::cin >> N;
    Vec<int> divs;
    for (int i = 1; i * i <= N; ++i) {
        if (N % i == 0) {
            divs.push_back(i);
            if (i * i != N) {
                divs.push_back(N / i);
            }
        }
    }
    std::sort(divs.begin(), divs.end());
    Vec<std::set<int>> ways(divs.size());
    ways[0].insert(0);
    for (int i = 1; i < (int) divs.size(); ++i) {
        for (int j = 0; j < i; ++j) {
            if (divs[i] % divs[j] == 0) {
                const auto add = (divs[i] / divs[j]) - 1;
                for (const auto x: ways[j]) {
                    ways[i].insert(x + add);
                }
            }
        }
    }
    const auto& ans = ways.back();
    std::cout << ans.size() << '\n';
    bool first = true;
    for (const auto x: ans) {
        if (!first) std::cout << ' ';
        first = false;
        std::cout << x;
    }
    std::cout << '\n';
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 2 ms 204 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 2 ms 204 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 4 ms 588 KB Output is correct
51 Correct 3 ms 460 KB Output is correct
52 Correct 4 ms 460 KB Output is correct
53 Correct 3 ms 460 KB Output is correct
54 Correct 2 ms 332 KB Output is correct
55 Correct 7 ms 668 KB Output is correct
56 Correct 5 ms 588 KB Output is correct
57 Correct 4 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 296 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 368 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 2 ms 204 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 4 ms 588 KB Output is correct
51 Correct 3 ms 460 KB Output is correct
52 Correct 4 ms 460 KB Output is correct
53 Correct 3 ms 460 KB Output is correct
54 Correct 2 ms 332 KB Output is correct
55 Correct 7 ms 668 KB Output is correct
56 Correct 5 ms 588 KB Output is correct
57 Correct 4 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 296 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 368 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 296 KB Output is correct
71 Correct 419 ms 18360 KB Output is correct
72 Correct 281 ms 14020 KB Output is correct
73 Correct 396 ms 16628 KB Output is correct
74 Correct 213 ms 10956 KB Output is correct
75 Correct 248 ms 11712 KB Output is correct
76 Correct 657 ms 24744 KB Output is correct
77 Correct 610 ms 21956 KB Output is correct
78 Correct 533 ms 20540 KB Output is correct
79 Correct 509 ms 19908 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 3 ms 204 KB Output is correct
82 Correct 4 ms 588 KB Output is correct
83 Correct 56 ms 3656 KB Output is correct
84 Correct 72 ms 4340 KB Output is correct
85 Correct 16 ms 1468 KB Output is correct
86 Correct 1 ms 204 KB Output is correct
87 Correct 77 ms 4908 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 204 KB Output is correct
91 Correct 21 ms 2056 KB Output is correct
92 Correct 94 ms 6496 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 296 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 292 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 292 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 2 ms 204 KB Output is correct
40 Correct 1 ms 296 KB Output is correct
41 Correct 1 ms 204 KB Output is correct
42 Correct 1 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 4 ms 588 KB Output is correct
51 Correct 3 ms 460 KB Output is correct
52 Correct 4 ms 460 KB Output is correct
53 Correct 3 ms 460 KB Output is correct
54 Correct 2 ms 332 KB Output is correct
55 Correct 7 ms 668 KB Output is correct
56 Correct 5 ms 588 KB Output is correct
57 Correct 4 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 296 KB Output is correct
60 Correct 1 ms 336 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 368 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 2 ms 296 KB Output is correct
71 Correct 419 ms 18360 KB Output is correct
72 Correct 281 ms 14020 KB Output is correct
73 Correct 396 ms 16628 KB Output is correct
74 Correct 213 ms 10956 KB Output is correct
75 Correct 248 ms 11712 KB Output is correct
76 Correct 657 ms 24744 KB Output is correct
77 Correct 610 ms 21956 KB Output is correct
78 Correct 533 ms 20540 KB Output is correct
79 Correct 509 ms 19908 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 3 ms 204 KB Output is correct
82 Correct 4 ms 588 KB Output is correct
83 Correct 56 ms 3656 KB Output is correct
84 Correct 72 ms 4340 KB Output is correct
85 Correct 16 ms 1468 KB Output is correct
86 Correct 1 ms 204 KB Output is correct
87 Correct 77 ms 4908 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 204 KB Output is correct
91 Correct 21 ms 2056 KB Output is correct
92 Correct 94 ms 6496 KB Output is correct
93 Correct 2486 ms 77520 KB Output is correct
94 Correct 1365 ms 52016 KB Output is correct
95 Correct 1578 ms 54528 KB Output is correct
96 Correct 1363 ms 48716 KB Output is correct
97 Correct 1265 ms 44228 KB Output is correct
98 Correct 2820 ms 85236 KB Output is correct
99 Correct 2989 ms 86668 KB Output is correct
100 Correct 2745 ms 83232 KB Output is correct
101 Correct 2591 ms 77048 KB Output is correct
102 Correct 2267 ms 69316 KB Output is correct
103 Correct 1825 ms 62120 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 7 ms 844 KB Output is correct
107 Correct 190 ms 9448 KB Output is correct
108 Correct 479 ms 20200 KB Output is correct
109 Correct 40 ms 3140 KB Output is correct
110 Correct 1 ms 204 KB Output is correct
111 Correct 235 ms 12032 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 204 KB Output is correct
114 Correct 7 ms 844 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 15 ms 1568 KB Output is correct
117 Correct 465 ms 24596 KB Output is correct