답안 #156333

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
156333 2019-10-05T07:19:57 Z lyc Toys (CEOI18_toy) C++14
100 / 100
3454 ms 91252 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef long double ld;
typedef pair<int, int> ii;
typedef pair<int, ii> iii;
typedef pair<ii, int> ri3;
#define mp make_pair
#define pb push_back
#define fi first
#define sc second
#define SZ(x) (int)(x).size()
#define ALL(x) begin(x), end(x) 
#define REP(i, n) for (int i = 0; i < n; ++i) 
#define FOR(i, a, b) for (int i = a; i <= b; ++i)
#define RFOR(i, a, b) for (int i = a; i >= b; --i)

int N;
vector<int> d;
set<int> dp[100005];

int main() {
    //freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    cin.tie(0);

    cin >> N;
    for (int i = 1; i*i <= N; ++i) {
        if (N%i == 0) {
            d.push_back(i);
            if (N/i != i) d.push_back(N/i);
        }
    }
    sort(ALL(d));

    dp[0].insert(0);
    for (int i = 1; i < SZ(d); ++i) {
        for (int j = 0; j < i; ++j) {
            if (d[i]%d[j] == 0) {
                for (auto x : dp[j]) dp[i].insert(x + d[i]/d[j] - 1);
            }
        }
    }

    cout << SZ(dp[SZ(d)-1]) << '\n';
    for (auto x : dp[SZ(d)-1]) cout << x << ' ';
    cout << '\n';
}

# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5112 KB Output is correct
2 Correct 6 ms 5112 KB Output is correct
3 Correct 6 ms 5112 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 7 ms 5112 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 5112 KB Output is correct
9 Correct 6 ms 5084 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 5112 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 7 ms 5112 KB Output is correct
17 Correct 12 ms 5112 KB Output is correct
18 Correct 6 ms 5112 KB Output is correct
19 Correct 6 ms 4984 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5112 KB Output is correct
22 Correct 7 ms 5112 KB Output is correct
23 Correct 6 ms 4984 KB Output is correct
24 Correct 6 ms 5240 KB Output is correct
25 Correct 7 ms 5112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5112 KB Output is correct
2 Correct 6 ms 5112 KB Output is correct
3 Correct 6 ms 5112 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 7 ms 5112 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 5112 KB Output is correct
9 Correct 6 ms 5084 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 5112 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 7 ms 5112 KB Output is correct
17 Correct 12 ms 5112 KB Output is correct
18 Correct 6 ms 5112 KB Output is correct
19 Correct 6 ms 4984 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5112 KB Output is correct
22 Correct 7 ms 5112 KB Output is correct
23 Correct 6 ms 4984 KB Output is correct
24 Correct 6 ms 5240 KB Output is correct
25 Correct 7 ms 5112 KB Output is correct
26 Correct 8 ms 5112 KB Output is correct
27 Correct 7 ms 5112 KB Output is correct
28 Correct 6 ms 4988 KB Output is correct
29 Correct 8 ms 4984 KB Output is correct
30 Correct 5 ms 4984 KB Output is correct
31 Correct 7 ms 5112 KB Output is correct
32 Correct 7 ms 5112 KB Output is correct
33 Correct 7 ms 5112 KB Output is correct
34 Correct 6 ms 4984 KB Output is correct
35 Correct 6 ms 4984 KB Output is correct
36 Correct 8 ms 4984 KB Output is correct
37 Correct 8 ms 5112 KB Output is correct
38 Correct 6 ms 5112 KB Output is correct
39 Correct 6 ms 5112 KB Output is correct
40 Correct 8 ms 5112 KB Output is correct
41 Correct 8 ms 5112 KB Output is correct
42 Correct 8 ms 5112 KB Output is correct
43 Correct 7 ms 4984 KB Output is correct
44 Correct 8 ms 5112 KB Output is correct
45 Correct 6 ms 4984 KB Output is correct
46 Correct 8 ms 5112 KB Output is correct
47 Correct 8 ms 5112 KB Output is correct
48 Correct 8 ms 5112 KB Output is correct
49 Correct 7 ms 5112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5112 KB Output is correct
2 Correct 6 ms 5112 KB Output is correct
3 Correct 6 ms 5112 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 7 ms 5112 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 5112 KB Output is correct
9 Correct 6 ms 5084 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 5112 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 7 ms 5112 KB Output is correct
17 Correct 12 ms 5112 KB Output is correct
18 Correct 6 ms 5112 KB Output is correct
19 Correct 6 ms 4984 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5112 KB Output is correct
22 Correct 7 ms 5112 KB Output is correct
23 Correct 6 ms 4984 KB Output is correct
24 Correct 6 ms 5240 KB Output is correct
25 Correct 7 ms 5112 KB Output is correct
26 Correct 8 ms 5112 KB Output is correct
27 Correct 7 ms 5112 KB Output is correct
28 Correct 6 ms 4988 KB Output is correct
29 Correct 8 ms 4984 KB Output is correct
30 Correct 5 ms 4984 KB Output is correct
31 Correct 7 ms 5112 KB Output is correct
32 Correct 7 ms 5112 KB Output is correct
33 Correct 7 ms 5112 KB Output is correct
34 Correct 6 ms 4984 KB Output is correct
35 Correct 6 ms 4984 KB Output is correct
36 Correct 8 ms 4984 KB Output is correct
37 Correct 8 ms 5112 KB Output is correct
38 Correct 6 ms 5112 KB Output is correct
39 Correct 6 ms 5112 KB Output is correct
40 Correct 8 ms 5112 KB Output is correct
41 Correct 8 ms 5112 KB Output is correct
42 Correct 8 ms 5112 KB Output is correct
43 Correct 7 ms 4984 KB Output is correct
44 Correct 8 ms 5112 KB Output is correct
45 Correct 6 ms 4984 KB Output is correct
46 Correct 8 ms 5112 KB Output is correct
47 Correct 8 ms 5112 KB Output is correct
48 Correct 8 ms 5112 KB Output is correct
49 Correct 7 ms 5112 KB Output is correct
50 Correct 11 ms 5244 KB Output is correct
51 Correct 11 ms 5228 KB Output is correct
52 Correct 10 ms 5244 KB Output is correct
53 Correct 19 ms 5240 KB Output is correct
54 Correct 7 ms 5112 KB Output is correct
55 Correct 11 ms 5368 KB Output is correct
56 Correct 11 ms 5368 KB Output is correct
57 Correct 11 ms 5368 KB Output is correct
58 Correct 6 ms 4984 KB Output is correct
59 Correct 6 ms 5240 KB Output is correct
60 Correct 7 ms 5112 KB Output is correct
61 Correct 8 ms 5240 KB Output is correct
62 Correct 7 ms 5112 KB Output is correct
63 Correct 7 ms 5112 KB Output is correct
64 Correct 6 ms 5028 KB Output is correct
65 Correct 8 ms 5240 KB Output is correct
66 Correct 6 ms 4984 KB Output is correct
67 Correct 6 ms 5112 KB Output is correct
68 Correct 6 ms 4984 KB Output is correct
69 Correct 6 ms 5112 KB Output is correct
70 Correct 7 ms 5112 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5112 KB Output is correct
2 Correct 6 ms 5112 KB Output is correct
3 Correct 6 ms 5112 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 7 ms 5112 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 5112 KB Output is correct
9 Correct 6 ms 5084 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 5112 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 7 ms 5112 KB Output is correct
17 Correct 12 ms 5112 KB Output is correct
18 Correct 6 ms 5112 KB Output is correct
19 Correct 6 ms 4984 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5112 KB Output is correct
22 Correct 7 ms 5112 KB Output is correct
23 Correct 6 ms 4984 KB Output is correct
24 Correct 6 ms 5240 KB Output is correct
25 Correct 7 ms 5112 KB Output is correct
26 Correct 8 ms 5112 KB Output is correct
27 Correct 7 ms 5112 KB Output is correct
28 Correct 6 ms 4988 KB Output is correct
29 Correct 8 ms 4984 KB Output is correct
30 Correct 5 ms 4984 KB Output is correct
31 Correct 7 ms 5112 KB Output is correct
32 Correct 7 ms 5112 KB Output is correct
33 Correct 7 ms 5112 KB Output is correct
34 Correct 6 ms 4984 KB Output is correct
35 Correct 6 ms 4984 KB Output is correct
36 Correct 8 ms 4984 KB Output is correct
37 Correct 8 ms 5112 KB Output is correct
38 Correct 6 ms 5112 KB Output is correct
39 Correct 6 ms 5112 KB Output is correct
40 Correct 8 ms 5112 KB Output is correct
41 Correct 8 ms 5112 KB Output is correct
42 Correct 8 ms 5112 KB Output is correct
43 Correct 7 ms 4984 KB Output is correct
44 Correct 8 ms 5112 KB Output is correct
45 Correct 6 ms 4984 KB Output is correct
46 Correct 8 ms 5112 KB Output is correct
47 Correct 8 ms 5112 KB Output is correct
48 Correct 8 ms 5112 KB Output is correct
49 Correct 7 ms 5112 KB Output is correct
50 Correct 11 ms 5244 KB Output is correct
51 Correct 11 ms 5228 KB Output is correct
52 Correct 10 ms 5244 KB Output is correct
53 Correct 19 ms 5240 KB Output is correct
54 Correct 7 ms 5112 KB Output is correct
55 Correct 11 ms 5368 KB Output is correct
56 Correct 11 ms 5368 KB Output is correct
57 Correct 11 ms 5368 KB Output is correct
58 Correct 6 ms 4984 KB Output is correct
59 Correct 6 ms 5240 KB Output is correct
60 Correct 7 ms 5112 KB Output is correct
61 Correct 8 ms 5240 KB Output is correct
62 Correct 7 ms 5112 KB Output is correct
63 Correct 7 ms 5112 KB Output is correct
64 Correct 6 ms 5028 KB Output is correct
65 Correct 8 ms 5240 KB Output is correct
66 Correct 6 ms 4984 KB Output is correct
67 Correct 6 ms 5112 KB Output is correct
68 Correct 6 ms 4984 KB Output is correct
69 Correct 6 ms 5112 KB Output is correct
70 Correct 7 ms 5112 KB Output is correct
71 Correct 499 ms 23360 KB Output is correct
72 Correct 337 ms 18792 KB Output is correct
73 Correct 463 ms 21100 KB Output is correct
74 Correct 270 ms 15836 KB Output is correct
75 Correct 297 ms 16504 KB Output is correct
76 Correct 786 ms 29692 KB Output is correct
77 Correct 697 ms 26744 KB Output is correct
78 Correct 607 ms 25336 KB Output is correct
79 Correct 591 ms 24824 KB Output is correct
80 Correct 6 ms 4984 KB Output is correct
81 Correct 6 ms 5112 KB Output is correct
82 Correct 10 ms 5368 KB Output is correct
83 Correct 69 ms 8292 KB Output is correct
84 Correct 85 ms 9080 KB Output is correct
85 Correct 23 ms 6264 KB Output is correct
86 Correct 6 ms 5112 KB Output is correct
87 Correct 95 ms 9720 KB Output is correct
88 Correct 7 ms 5116 KB Output is correct
89 Correct 6 ms 5112 KB Output is correct
90 Correct 6 ms 5112 KB Output is correct
91 Correct 29 ms 6904 KB Output is correct
92 Correct 113 ms 11256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 6 ms 5112 KB Output is correct
2 Correct 6 ms 5112 KB Output is correct
3 Correct 6 ms 5112 KB Output is correct
4 Correct 6 ms 5112 KB Output is correct
5 Correct 6 ms 5112 KB Output is correct
6 Correct 7 ms 5112 KB Output is correct
7 Correct 6 ms 4984 KB Output is correct
8 Correct 6 ms 5112 KB Output is correct
9 Correct 6 ms 5084 KB Output is correct
10 Correct 6 ms 4984 KB Output is correct
11 Correct 6 ms 4984 KB Output is correct
12 Correct 6 ms 5112 KB Output is correct
13 Correct 6 ms 4984 KB Output is correct
14 Correct 6 ms 4984 KB Output is correct
15 Correct 6 ms 4984 KB Output is correct
16 Correct 7 ms 5112 KB Output is correct
17 Correct 12 ms 5112 KB Output is correct
18 Correct 6 ms 5112 KB Output is correct
19 Correct 6 ms 4984 KB Output is correct
20 Correct 6 ms 5112 KB Output is correct
21 Correct 6 ms 5112 KB Output is correct
22 Correct 7 ms 5112 KB Output is correct
23 Correct 6 ms 4984 KB Output is correct
24 Correct 6 ms 5240 KB Output is correct
25 Correct 7 ms 5112 KB Output is correct
26 Correct 8 ms 5112 KB Output is correct
27 Correct 7 ms 5112 KB Output is correct
28 Correct 6 ms 4988 KB Output is correct
29 Correct 8 ms 4984 KB Output is correct
30 Correct 5 ms 4984 KB Output is correct
31 Correct 7 ms 5112 KB Output is correct
32 Correct 7 ms 5112 KB Output is correct
33 Correct 7 ms 5112 KB Output is correct
34 Correct 6 ms 4984 KB Output is correct
35 Correct 6 ms 4984 KB Output is correct
36 Correct 8 ms 4984 KB Output is correct
37 Correct 8 ms 5112 KB Output is correct
38 Correct 6 ms 5112 KB Output is correct
39 Correct 6 ms 5112 KB Output is correct
40 Correct 8 ms 5112 KB Output is correct
41 Correct 8 ms 5112 KB Output is correct
42 Correct 8 ms 5112 KB Output is correct
43 Correct 7 ms 4984 KB Output is correct
44 Correct 8 ms 5112 KB Output is correct
45 Correct 6 ms 4984 KB Output is correct
46 Correct 8 ms 5112 KB Output is correct
47 Correct 8 ms 5112 KB Output is correct
48 Correct 8 ms 5112 KB Output is correct
49 Correct 7 ms 5112 KB Output is correct
50 Correct 11 ms 5244 KB Output is correct
51 Correct 11 ms 5228 KB Output is correct
52 Correct 10 ms 5244 KB Output is correct
53 Correct 19 ms 5240 KB Output is correct
54 Correct 7 ms 5112 KB Output is correct
55 Correct 11 ms 5368 KB Output is correct
56 Correct 11 ms 5368 KB Output is correct
57 Correct 11 ms 5368 KB Output is correct
58 Correct 6 ms 4984 KB Output is correct
59 Correct 6 ms 5240 KB Output is correct
60 Correct 7 ms 5112 KB Output is correct
61 Correct 8 ms 5240 KB Output is correct
62 Correct 7 ms 5112 KB Output is correct
63 Correct 7 ms 5112 KB Output is correct
64 Correct 6 ms 5028 KB Output is correct
65 Correct 8 ms 5240 KB Output is correct
66 Correct 6 ms 4984 KB Output is correct
67 Correct 6 ms 5112 KB Output is correct
68 Correct 6 ms 4984 KB Output is correct
69 Correct 6 ms 5112 KB Output is correct
70 Correct 7 ms 5112 KB Output is correct
71 Correct 499 ms 23360 KB Output is correct
72 Correct 337 ms 18792 KB Output is correct
73 Correct 463 ms 21100 KB Output is correct
74 Correct 270 ms 15836 KB Output is correct
75 Correct 297 ms 16504 KB Output is correct
76 Correct 786 ms 29692 KB Output is correct
77 Correct 697 ms 26744 KB Output is correct
78 Correct 607 ms 25336 KB Output is correct
79 Correct 591 ms 24824 KB Output is correct
80 Correct 6 ms 4984 KB Output is correct
81 Correct 6 ms 5112 KB Output is correct
82 Correct 10 ms 5368 KB Output is correct
83 Correct 69 ms 8292 KB Output is correct
84 Correct 85 ms 9080 KB Output is correct
85 Correct 23 ms 6264 KB Output is correct
86 Correct 6 ms 5112 KB Output is correct
87 Correct 95 ms 9720 KB Output is correct
88 Correct 7 ms 5116 KB Output is correct
89 Correct 6 ms 5112 KB Output is correct
90 Correct 6 ms 5112 KB Output is correct
91 Correct 29 ms 6904 KB Output is correct
92 Correct 113 ms 11256 KB Output is correct
93 Correct 3068 ms 81972 KB Output is correct
94 Correct 1591 ms 56772 KB Output is correct
95 Correct 1811 ms 59240 KB Output is correct
96 Correct 1648 ms 53492 KB Output is correct
97 Correct 1485 ms 49308 KB Output is correct
98 Correct 3336 ms 90048 KB Output is correct
99 Correct 3454 ms 91252 KB Output is correct
100 Correct 3210 ms 88108 KB Output is correct
101 Correct 3102 ms 81900 KB Output is correct
102 Correct 2696 ms 74132 KB Output is correct
103 Correct 2151 ms 67100 KB Output is correct
104 Correct 6 ms 5112 KB Output is correct
105 Correct 6 ms 4984 KB Output is correct
106 Correct 14 ms 5624 KB Output is correct
107 Correct 225 ms 14256 KB Output is correct
108 Correct 583 ms 25260 KB Output is correct
109 Correct 54 ms 7944 KB Output is correct
110 Correct 6 ms 4984 KB Output is correct
111 Correct 288 ms 16760 KB Output is correct
112 Correct 7 ms 4984 KB Output is correct
113 Correct 6 ms 4984 KB Output is correct
114 Correct 12 ms 5624 KB Output is correct
115 Correct 6 ms 4984 KB Output is correct
116 Correct 23 ms 6392 KB Output is correct
117 Correct 549 ms 29316 KB Output is correct