Submission #205323

# Submission time Handle Problem Language Result Execution time Memory
205323 2020-02-28T14:31:21 Z dolphingarlic Toys (CEOI18_toy) C++14
100 / 100
904 ms 88200 KB
#include <bits/stdc++.h>
#define FOR(i, x, y) for (int i = x; i < y; i++)
typedef long long ll;
using namespace std;

vector<int> divisors;
unordered_set<int> dp[100001];

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    int n;
    cin >> n;
    for (int i = 1; i * i <= n; i++) if (!(n % i)) {
        divisors.push_back(i);
        if (i * i != n) divisors.push_back(n / i);
    }
    sort(divisors.begin(), divisors.end());

    dp[0].insert(0);
    int d = divisors.size();
    for (int i = 0; i < d; i++) {
        for (int j = 0; j < i; j++) {
            if (divisors[i] % divisors[j]) continue;
            for (int k : dp[j]) dp[i].insert(k + divisors[i] / divisors[j] - 1);
        }
    }

    set<int> res;
    for (int i : dp[d - 1]) res.insert(i);
    cout << res.size() << '\n';
    for (int i : res) cout << i << ' ';
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5752 KB Output is correct
2 Correct 8 ms 5752 KB Output is correct
3 Correct 8 ms 5880 KB Output is correct
4 Correct 9 ms 5880 KB Output is correct
5 Correct 8 ms 5752 KB Output is correct
6 Correct 8 ms 5752 KB Output is correct
7 Correct 9 ms 5752 KB Output is correct
8 Correct 8 ms 5752 KB Output is correct
9 Correct 8 ms 5752 KB Output is correct
10 Correct 8 ms 5752 KB Output is correct
11 Correct 10 ms 5752 KB Output is correct
12 Correct 9 ms 5752 KB Output is correct
13 Correct 8 ms 5880 KB Output is correct
14 Correct 8 ms 5880 KB Output is correct
15 Correct 8 ms 5880 KB Output is correct
16 Correct 9 ms 5752 KB Output is correct
17 Correct 8 ms 5752 KB Output is correct
18 Correct 8 ms 5880 KB Output is correct
19 Correct 8 ms 5756 KB Output is correct
20 Correct 9 ms 5880 KB Output is correct
21 Correct 9 ms 5752 KB Output is correct
22 Correct 8 ms 5752 KB Output is correct
23 Correct 10 ms 5752 KB Output is correct
24 Correct 9 ms 5752 KB Output is correct
25 Correct 8 ms 5880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5752 KB Output is correct
2 Correct 8 ms 5752 KB Output is correct
3 Correct 8 ms 5880 KB Output is correct
4 Correct 9 ms 5880 KB Output is correct
5 Correct 8 ms 5752 KB Output is correct
6 Correct 8 ms 5752 KB Output is correct
7 Correct 9 ms 5752 KB Output is correct
8 Correct 8 ms 5752 KB Output is correct
9 Correct 8 ms 5752 KB Output is correct
10 Correct 8 ms 5752 KB Output is correct
11 Correct 10 ms 5752 KB Output is correct
12 Correct 9 ms 5752 KB Output is correct
13 Correct 8 ms 5880 KB Output is correct
14 Correct 8 ms 5880 KB Output is correct
15 Correct 8 ms 5880 KB Output is correct
16 Correct 9 ms 5752 KB Output is correct
17 Correct 8 ms 5752 KB Output is correct
18 Correct 8 ms 5880 KB Output is correct
19 Correct 8 ms 5756 KB Output is correct
20 Correct 9 ms 5880 KB Output is correct
21 Correct 9 ms 5752 KB Output is correct
22 Correct 8 ms 5752 KB Output is correct
23 Correct 10 ms 5752 KB Output is correct
24 Correct 9 ms 5752 KB Output is correct
25 Correct 8 ms 5880 KB Output is correct
26 Correct 9 ms 6008 KB Output is correct
27 Correct 9 ms 5880 KB Output is correct
28 Correct 9 ms 5880 KB Output is correct
29 Correct 8 ms 5880 KB Output is correct
30 Correct 9 ms 5880 KB Output is correct
31 Correct 9 ms 5880 KB Output is correct
32 Correct 9 ms 5880 KB Output is correct
33 Correct 9 ms 5880 KB Output is correct
34 Correct 8 ms 5884 KB Output is correct
35 Correct 8 ms 5880 KB Output is correct
36 Correct 8 ms 5880 KB Output is correct
37 Correct 9 ms 5880 KB Output is correct
38 Correct 9 ms 5884 KB Output is correct
39 Correct 8 ms 5756 KB Output is correct
40 Correct 9 ms 5880 KB Output is correct
41 Correct 9 ms 5880 KB Output is correct
42 Correct 8 ms 5752 KB Output is correct
43 Correct 9 ms 5880 KB Output is correct
44 Correct 8 ms 5880 KB Output is correct
45 Correct 9 ms 5880 KB Output is correct
46 Correct 9 ms 5880 KB Output is correct
47 Correct 8 ms 5884 KB Output is correct
48 Correct 9 ms 5752 KB Output is correct
49 Correct 8 ms 5880 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5752 KB Output is correct
2 Correct 8 ms 5752 KB Output is correct
3 Correct 8 ms 5880 KB Output is correct
4 Correct 9 ms 5880 KB Output is correct
5 Correct 8 ms 5752 KB Output is correct
6 Correct 8 ms 5752 KB Output is correct
7 Correct 9 ms 5752 KB Output is correct
8 Correct 8 ms 5752 KB Output is correct
9 Correct 8 ms 5752 KB Output is correct
10 Correct 8 ms 5752 KB Output is correct
11 Correct 10 ms 5752 KB Output is correct
12 Correct 9 ms 5752 KB Output is correct
13 Correct 8 ms 5880 KB Output is correct
14 Correct 8 ms 5880 KB Output is correct
15 Correct 8 ms 5880 KB Output is correct
16 Correct 9 ms 5752 KB Output is correct
17 Correct 8 ms 5752 KB Output is correct
18 Correct 8 ms 5880 KB Output is correct
19 Correct 8 ms 5756 KB Output is correct
20 Correct 9 ms 5880 KB Output is correct
21 Correct 9 ms 5752 KB Output is correct
22 Correct 8 ms 5752 KB Output is correct
23 Correct 10 ms 5752 KB Output is correct
24 Correct 9 ms 5752 KB Output is correct
25 Correct 8 ms 5880 KB Output is correct
26 Correct 9 ms 6008 KB Output is correct
27 Correct 9 ms 5880 KB Output is correct
28 Correct 9 ms 5880 KB Output is correct
29 Correct 8 ms 5880 KB Output is correct
30 Correct 9 ms 5880 KB Output is correct
31 Correct 9 ms 5880 KB Output is correct
32 Correct 9 ms 5880 KB Output is correct
33 Correct 9 ms 5880 KB Output is correct
34 Correct 8 ms 5884 KB Output is correct
35 Correct 8 ms 5880 KB Output is correct
36 Correct 8 ms 5880 KB Output is correct
37 Correct 9 ms 5880 KB Output is correct
38 Correct 9 ms 5884 KB Output is correct
39 Correct 8 ms 5756 KB Output is correct
40 Correct 9 ms 5880 KB Output is correct
41 Correct 9 ms 5880 KB Output is correct
42 Correct 8 ms 5752 KB Output is correct
43 Correct 9 ms 5880 KB Output is correct
44 Correct 8 ms 5880 KB Output is correct
45 Correct 9 ms 5880 KB Output is correct
46 Correct 9 ms 5880 KB Output is correct
47 Correct 8 ms 5884 KB Output is correct
48 Correct 9 ms 5752 KB Output is correct
49 Correct 8 ms 5880 KB Output is correct
50 Correct 10 ms 6136 KB Output is correct
51 Correct 10 ms 6012 KB Output is correct
52 Correct 11 ms 6136 KB Output is correct
53 Correct 10 ms 6136 KB Output is correct
54 Correct 9 ms 6008 KB Output is correct
55 Correct 10 ms 6240 KB Output is correct
56 Correct 11 ms 6136 KB Output is correct
57 Correct 10 ms 6136 KB Output is correct
58 Correct 9 ms 5752 KB Output is correct
59 Correct 8 ms 5752 KB Output is correct
60 Correct 9 ms 5880 KB Output is correct
61 Correct 9 ms 6008 KB Output is correct
62 Correct 9 ms 5880 KB Output is correct
63 Correct 9 ms 5880 KB Output is correct
64 Correct 9 ms 5880 KB Output is correct
65 Correct 9 ms 6008 KB Output is correct
66 Correct 8 ms 5880 KB Output is correct
67 Correct 9 ms 5752 KB Output is correct
68 Correct 9 ms 5880 KB Output is correct
69 Correct 10 ms 5880 KB Output is correct
70 Correct 9 ms 5884 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5752 KB Output is correct
2 Correct 8 ms 5752 KB Output is correct
3 Correct 8 ms 5880 KB Output is correct
4 Correct 9 ms 5880 KB Output is correct
5 Correct 8 ms 5752 KB Output is correct
6 Correct 8 ms 5752 KB Output is correct
7 Correct 9 ms 5752 KB Output is correct
8 Correct 8 ms 5752 KB Output is correct
9 Correct 8 ms 5752 KB Output is correct
10 Correct 8 ms 5752 KB Output is correct
11 Correct 10 ms 5752 KB Output is correct
12 Correct 9 ms 5752 KB Output is correct
13 Correct 8 ms 5880 KB Output is correct
14 Correct 8 ms 5880 KB Output is correct
15 Correct 8 ms 5880 KB Output is correct
16 Correct 9 ms 5752 KB Output is correct
17 Correct 8 ms 5752 KB Output is correct
18 Correct 8 ms 5880 KB Output is correct
19 Correct 8 ms 5756 KB Output is correct
20 Correct 9 ms 5880 KB Output is correct
21 Correct 9 ms 5752 KB Output is correct
22 Correct 8 ms 5752 KB Output is correct
23 Correct 10 ms 5752 KB Output is correct
24 Correct 9 ms 5752 KB Output is correct
25 Correct 8 ms 5880 KB Output is correct
26 Correct 9 ms 6008 KB Output is correct
27 Correct 9 ms 5880 KB Output is correct
28 Correct 9 ms 5880 KB Output is correct
29 Correct 8 ms 5880 KB Output is correct
30 Correct 9 ms 5880 KB Output is correct
31 Correct 9 ms 5880 KB Output is correct
32 Correct 9 ms 5880 KB Output is correct
33 Correct 9 ms 5880 KB Output is correct
34 Correct 8 ms 5884 KB Output is correct
35 Correct 8 ms 5880 KB Output is correct
36 Correct 8 ms 5880 KB Output is correct
37 Correct 9 ms 5880 KB Output is correct
38 Correct 9 ms 5884 KB Output is correct
39 Correct 8 ms 5756 KB Output is correct
40 Correct 9 ms 5880 KB Output is correct
41 Correct 9 ms 5880 KB Output is correct
42 Correct 8 ms 5752 KB Output is correct
43 Correct 9 ms 5880 KB Output is correct
44 Correct 8 ms 5880 KB Output is correct
45 Correct 9 ms 5880 KB Output is correct
46 Correct 9 ms 5880 KB Output is correct
47 Correct 8 ms 5884 KB Output is correct
48 Correct 9 ms 5752 KB Output is correct
49 Correct 8 ms 5880 KB Output is correct
50 Correct 10 ms 6136 KB Output is correct
51 Correct 10 ms 6012 KB Output is correct
52 Correct 11 ms 6136 KB Output is correct
53 Correct 10 ms 6136 KB Output is correct
54 Correct 9 ms 6008 KB Output is correct
55 Correct 10 ms 6240 KB Output is correct
56 Correct 11 ms 6136 KB Output is correct
57 Correct 10 ms 6136 KB Output is correct
58 Correct 9 ms 5752 KB Output is correct
59 Correct 8 ms 5752 KB Output is correct
60 Correct 9 ms 5880 KB Output is correct
61 Correct 9 ms 6008 KB Output is correct
62 Correct 9 ms 5880 KB Output is correct
63 Correct 9 ms 5880 KB Output is correct
64 Correct 9 ms 5880 KB Output is correct
65 Correct 9 ms 6008 KB Output is correct
66 Correct 8 ms 5880 KB Output is correct
67 Correct 9 ms 5752 KB Output is correct
68 Correct 9 ms 5880 KB Output is correct
69 Correct 10 ms 5880 KB Output is correct
70 Correct 9 ms 5884 KB Output is correct
71 Correct 154 ms 23288 KB Output is correct
72 Correct 100 ms 19192 KB Output is correct
73 Correct 126 ms 21368 KB Output is correct
74 Correct 74 ms 16380 KB Output is correct
75 Correct 83 ms 17020 KB Output is correct
76 Correct 204 ms 29304 KB Output is correct
77 Correct 182 ms 26616 KB Output is correct
78 Correct 160 ms 25336 KB Output is correct
79 Correct 161 ms 24696 KB Output is correct
80 Correct 9 ms 5880 KB Output is correct
81 Correct 9 ms 5880 KB Output is correct
82 Correct 10 ms 6168 KB Output is correct
83 Correct 27 ms 9212 KB Output is correct
84 Correct 31 ms 9848 KB Output is correct
85 Correct 15 ms 7032 KB Output is correct
86 Correct 10 ms 5880 KB Output is correct
87 Correct 34 ms 10616 KB Output is correct
88 Correct 8 ms 5880 KB Output is correct
89 Correct 9 ms 5880 KB Output is correct
90 Correct 9 ms 5880 KB Output is correct
91 Correct 18 ms 7672 KB Output is correct
92 Correct 44 ms 12024 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5752 KB Output is correct
2 Correct 8 ms 5752 KB Output is correct
3 Correct 8 ms 5880 KB Output is correct
4 Correct 9 ms 5880 KB Output is correct
5 Correct 8 ms 5752 KB Output is correct
6 Correct 8 ms 5752 KB Output is correct
7 Correct 9 ms 5752 KB Output is correct
8 Correct 8 ms 5752 KB Output is correct
9 Correct 8 ms 5752 KB Output is correct
10 Correct 8 ms 5752 KB Output is correct
11 Correct 10 ms 5752 KB Output is correct
12 Correct 9 ms 5752 KB Output is correct
13 Correct 8 ms 5880 KB Output is correct
14 Correct 8 ms 5880 KB Output is correct
15 Correct 8 ms 5880 KB Output is correct
16 Correct 9 ms 5752 KB Output is correct
17 Correct 8 ms 5752 KB Output is correct
18 Correct 8 ms 5880 KB Output is correct
19 Correct 8 ms 5756 KB Output is correct
20 Correct 9 ms 5880 KB Output is correct
21 Correct 9 ms 5752 KB Output is correct
22 Correct 8 ms 5752 KB Output is correct
23 Correct 10 ms 5752 KB Output is correct
24 Correct 9 ms 5752 KB Output is correct
25 Correct 8 ms 5880 KB Output is correct
26 Correct 9 ms 6008 KB Output is correct
27 Correct 9 ms 5880 KB Output is correct
28 Correct 9 ms 5880 KB Output is correct
29 Correct 8 ms 5880 KB Output is correct
30 Correct 9 ms 5880 KB Output is correct
31 Correct 9 ms 5880 KB Output is correct
32 Correct 9 ms 5880 KB Output is correct
33 Correct 9 ms 5880 KB Output is correct
34 Correct 8 ms 5884 KB Output is correct
35 Correct 8 ms 5880 KB Output is correct
36 Correct 8 ms 5880 KB Output is correct
37 Correct 9 ms 5880 KB Output is correct
38 Correct 9 ms 5884 KB Output is correct
39 Correct 8 ms 5756 KB Output is correct
40 Correct 9 ms 5880 KB Output is correct
41 Correct 9 ms 5880 KB Output is correct
42 Correct 8 ms 5752 KB Output is correct
43 Correct 9 ms 5880 KB Output is correct
44 Correct 8 ms 5880 KB Output is correct
45 Correct 9 ms 5880 KB Output is correct
46 Correct 9 ms 5880 KB Output is correct
47 Correct 8 ms 5884 KB Output is correct
48 Correct 9 ms 5752 KB Output is correct
49 Correct 8 ms 5880 KB Output is correct
50 Correct 10 ms 6136 KB Output is correct
51 Correct 10 ms 6012 KB Output is correct
52 Correct 11 ms 6136 KB Output is correct
53 Correct 10 ms 6136 KB Output is correct
54 Correct 9 ms 6008 KB Output is correct
55 Correct 10 ms 6240 KB Output is correct
56 Correct 11 ms 6136 KB Output is correct
57 Correct 10 ms 6136 KB Output is correct
58 Correct 9 ms 5752 KB Output is correct
59 Correct 8 ms 5752 KB Output is correct
60 Correct 9 ms 5880 KB Output is correct
61 Correct 9 ms 6008 KB Output is correct
62 Correct 9 ms 5880 KB Output is correct
63 Correct 9 ms 5880 KB Output is correct
64 Correct 9 ms 5880 KB Output is correct
65 Correct 9 ms 6008 KB Output is correct
66 Correct 8 ms 5880 KB Output is correct
67 Correct 9 ms 5752 KB Output is correct
68 Correct 9 ms 5880 KB Output is correct
69 Correct 10 ms 5880 KB Output is correct
70 Correct 9 ms 5884 KB Output is correct
71 Correct 154 ms 23288 KB Output is correct
72 Correct 100 ms 19192 KB Output is correct
73 Correct 126 ms 21368 KB Output is correct
74 Correct 74 ms 16380 KB Output is correct
75 Correct 83 ms 17020 KB Output is correct
76 Correct 204 ms 29304 KB Output is correct
77 Correct 182 ms 26616 KB Output is correct
78 Correct 160 ms 25336 KB Output is correct
79 Correct 161 ms 24696 KB Output is correct
80 Correct 9 ms 5880 KB Output is correct
81 Correct 9 ms 5880 KB Output is correct
82 Correct 10 ms 6168 KB Output is correct
83 Correct 27 ms 9212 KB Output is correct
84 Correct 31 ms 9848 KB Output is correct
85 Correct 15 ms 7032 KB Output is correct
86 Correct 10 ms 5880 KB Output is correct
87 Correct 34 ms 10616 KB Output is correct
88 Correct 8 ms 5880 KB Output is correct
89 Correct 9 ms 5880 KB Output is correct
90 Correct 9 ms 5880 KB Output is correct
91 Correct 18 ms 7672 KB Output is correct
92 Correct 44 ms 12024 KB Output is correct
93 Correct 768 ms 79300 KB Output is correct
94 Correct 446 ms 55816 KB Output is correct
95 Correct 493 ms 58120 KB Output is correct
96 Correct 439 ms 52264 KB Output is correct
97 Correct 403 ms 47784 KB Output is correct
98 Correct 872 ms 86792 KB Output is correct
99 Correct 904 ms 88200 KB Output is correct
100 Correct 830 ms 84360 KB Output is correct
101 Correct 786 ms 78856 KB Output is correct
102 Correct 692 ms 71816 KB Output is correct
103 Correct 590 ms 65160 KB Output is correct
104 Correct 9 ms 5752 KB Output is correct
105 Correct 9 ms 5860 KB Output is correct
106 Correct 12 ms 6520 KB Output is correct
107 Correct 71 ms 14968 KB Output is correct
108 Correct 166 ms 25640 KB Output is correct
109 Correct 24 ms 8824 KB Output is correct
110 Correct 8 ms 5880 KB Output is correct
111 Correct 88 ms 17528 KB Output is correct
112 Correct 9 ms 5752 KB Output is correct
113 Correct 9 ms 5752 KB Output is correct
114 Correct 12 ms 6520 KB Output is correct
115 Correct 10 ms 5752 KB Output is correct
116 Correct 16 ms 7288 KB Output is correct
117 Correct 182 ms 29608 KB Output is correct