답안 #490993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
490993 2021-11-30T03:00:54 Z Rainbowbunny Toys (CEOI18_toy) C++17
100 / 100
1162 ms 11252 KB
#include <bits/stdc++.h>
using namespace std;
 
const int MAXN = 5005;
 
int n;
vector <int> Ans[MAXN];
 
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cin >> n;
    vector <int> Div;
    for(int i = 1; i * i <= n; i++)
    {
        if(n % i == 0)
        {
            Div.push_back(i);
            if(n != i * i)
            {
                Div.push_back(n / i);
            }
        }
    }
    sort(Div.begin(), Div.end());
    for(int i = 0; i < (int)Div.size(); i++)
    {
        Ans[i].push_back(Div[i] - 1);
        for(int j = 1; j < i; j++)
        {
            if(Div[i] % Div[j])
            {
                continue;
            }
            int tmp = Div[i] / Div[j] - 1;
            vector <int> tt;
            int pt0 = 0, pt1 = 0;
            while(pt0 < (int)Ans[i].size() and pt1 < (int)Ans[j].size())
            {
                if(Ans[i][pt0] <= Ans[j][pt1] + tmp)
                {
                    if(tt.empty() or tt.back() != Ans[i][pt0])
                    {
                        tt.push_back(Ans[i][pt0]);
                    }
                    pt0++;
                }
                else
                {
                    if(tt.empty() or tt.back() != Ans[j][pt1] + tmp)
                    {
                        tt.push_back(Ans[j][pt1] + tmp);
                    }
                    pt1++;
                }
            }
            while(pt0 < (int)Ans[i].size())
            {
                if(tt.empty() or tt.back() != Ans[i][pt0])
                {
                    tt.push_back(Ans[i][pt0]);
                }
                pt0++;
            }
            while(pt1 < (int)Ans[j].size())
            {
                if(tt.empty() or tt.back() != Ans[j][pt1] + tmp)
                {
                    tt.push_back(Ans[j][pt1] + tmp);
                }
                pt1++;
            }
            Ans[i].swap(tt);
        }
    }
    cout << Ans[(int)Div.size() - 1].size() << '\n';
    for(auto x : Ans[(int)Div.size() - 1])
    {
        cout << x << ' ';
    }
    cout << '\n';
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 0 ms 332 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 0 ms 332 KB Output is correct
22 Correct 0 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 0 ms 332 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 0 ms 332 KB Output is correct
22 Correct 0 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 0 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 0 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 332 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 0 ms 332 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 0 ms 332 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 332 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 0 ms 332 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 0 ms 332 KB Output is correct
22 Correct 0 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 0 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 0 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 332 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 0 ms 332 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 0 ms 332 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 332 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 460 KB Output is correct
56 Correct 2 ms 460 KB Output is correct
57 Correct 3 ms 460 KB Output is correct
58 Correct 0 ms 332 KB Output is correct
59 Correct 1 ms 332 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 0 ms 332 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 332 KB Output is correct
67 Correct 0 ms 332 KB Output is correct
68 Correct 1 ms 332 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 0 ms 332 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 0 ms 332 KB Output is correct
22 Correct 0 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 0 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 0 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 332 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 0 ms 332 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 0 ms 332 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 332 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 460 KB Output is correct
56 Correct 2 ms 460 KB Output is correct
57 Correct 3 ms 460 KB Output is correct
58 Correct 0 ms 332 KB Output is correct
59 Correct 1 ms 332 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 0 ms 332 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 332 KB Output is correct
67 Correct 0 ms 332 KB Output is correct
68 Correct 1 ms 332 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 172 ms 2872 KB Output is correct
72 Correct 117 ms 2308 KB Output is correct
73 Correct 139 ms 2656 KB Output is correct
74 Correct 95 ms 1888 KB Output is correct
75 Correct 110 ms 2040 KB Output is correct
76 Correct 228 ms 3796 KB Output is correct
77 Correct 194 ms 3236 KB Output is correct
78 Correct 172 ms 3004 KB Output is correct
79 Correct 170 ms 3000 KB Output is correct
80 Correct 1 ms 332 KB Output is correct
81 Correct 1 ms 332 KB Output is correct
82 Correct 1 ms 460 KB Output is correct
83 Correct 13 ms 904 KB Output is correct
84 Correct 19 ms 968 KB Output is correct
85 Correct 5 ms 588 KB Output is correct
86 Correct 0 ms 332 KB Output is correct
87 Correct 19 ms 1148 KB Output is correct
88 Correct 0 ms 332 KB Output is correct
89 Correct 1 ms 332 KB Output is correct
90 Correct 1 ms 332 KB Output is correct
91 Correct 9 ms 716 KB Output is correct
92 Correct 50 ms 1224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 332 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Correct 0 ms 332 KB Output is correct
4 Correct 0 ms 332 KB Output is correct
5 Correct 0 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 0 ms 332 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 0 ms 332 KB Output is correct
11 Correct 0 ms 332 KB Output is correct
12 Correct 0 ms 332 KB Output is correct
13 Correct 0 ms 332 KB Output is correct
14 Correct 0 ms 332 KB Output is correct
15 Correct 0 ms 332 KB Output is correct
16 Correct 0 ms 332 KB Output is correct
17 Correct 0 ms 332 KB Output is correct
18 Correct 0 ms 332 KB Output is correct
19 Correct 0 ms 332 KB Output is correct
20 Correct 0 ms 332 KB Output is correct
21 Correct 0 ms 332 KB Output is correct
22 Correct 0 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 0 ms 332 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 0 ms 332 KB Output is correct
30 Correct 1 ms 332 KB Output is correct
31 Correct 1 ms 332 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 332 KB Output is correct
35 Correct 1 ms 332 KB Output is correct
36 Correct 0 ms 332 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 332 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 332 KB Output is correct
42 Correct 1 ms 332 KB Output is correct
43 Correct 0 ms 332 KB Output is correct
44 Correct 1 ms 332 KB Output is correct
45 Correct 0 ms 332 KB Output is correct
46 Correct 0 ms 332 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 332 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 460 KB Output is correct
56 Correct 2 ms 460 KB Output is correct
57 Correct 3 ms 460 KB Output is correct
58 Correct 0 ms 332 KB Output is correct
59 Correct 1 ms 332 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 0 ms 332 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 332 KB Output is correct
67 Correct 0 ms 332 KB Output is correct
68 Correct 1 ms 332 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 172 ms 2872 KB Output is correct
72 Correct 117 ms 2308 KB Output is correct
73 Correct 139 ms 2656 KB Output is correct
74 Correct 95 ms 1888 KB Output is correct
75 Correct 110 ms 2040 KB Output is correct
76 Correct 228 ms 3796 KB Output is correct
77 Correct 194 ms 3236 KB Output is correct
78 Correct 172 ms 3004 KB Output is correct
79 Correct 170 ms 3000 KB Output is correct
80 Correct 1 ms 332 KB Output is correct
81 Correct 1 ms 332 KB Output is correct
82 Correct 1 ms 460 KB Output is correct
83 Correct 13 ms 904 KB Output is correct
84 Correct 19 ms 968 KB Output is correct
85 Correct 5 ms 588 KB Output is correct
86 Correct 0 ms 332 KB Output is correct
87 Correct 19 ms 1148 KB Output is correct
88 Correct 0 ms 332 KB Output is correct
89 Correct 1 ms 332 KB Output is correct
90 Correct 1 ms 332 KB Output is correct
91 Correct 9 ms 716 KB Output is correct
92 Correct 50 ms 1224 KB Output is correct
93 Correct 1012 ms 10324 KB Output is correct
94 Correct 602 ms 7296 KB Output is correct
95 Correct 654 ms 7392 KB Output is correct
96 Correct 604 ms 6796 KB Output is correct
97 Correct 507 ms 6116 KB Output is correct
98 Correct 1086 ms 11252 KB Output is correct
99 Correct 1162 ms 11220 KB Output is correct
100 Correct 1122 ms 11016 KB Output is correct
101 Correct 934 ms 10292 KB Output is correct
102 Correct 750 ms 9060 KB Output is correct
103 Correct 736 ms 8524 KB Output is correct
104 Correct 1 ms 332 KB Output is correct
105 Correct 1 ms 332 KB Output is correct
106 Correct 2 ms 460 KB Output is correct
107 Correct 36 ms 1768 KB Output is correct
108 Correct 122 ms 3308 KB Output is correct
109 Correct 9 ms 756 KB Output is correct
110 Correct 1 ms 332 KB Output is correct
111 Correct 70 ms 2132 KB Output is correct
112 Correct 1 ms 332 KB Output is correct
113 Correct 1 ms 332 KB Output is correct
114 Correct 4 ms 460 KB Output is correct
115 Correct 1 ms 332 KB Output is correct
116 Correct 6 ms 588 KB Output is correct
117 Correct 258 ms 3768 KB Output is correct