답안 #1002419

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1002419 2024-06-19T14:37:09 Z daffuwu Toys (CEOI18_toy) C++14
100 / 100
1051 ms 112380 KB
#include <bits/stdc++.h>
using namespace std;
#define fr first
#define sc second
mt19937_64 rng(chrono::steady_clock::now().time_since_epoch().count());

int n, x, a, b;
vector<int> vc[100069], fac;

int main() 
{
    int i, j;
    scanf("%d", &n);
    for (i=1; i*i<=n; i++)
    {
        if (n%i == 0)
        {
            fac.push_back(i);
            if (i != n/i) fac.push_back(n/i);
        }
    }
    sort(fac.begin(), fac.end());
    vc[0].push_back(0);
    for (i=1; i<fac.size(); i++)
    {
        x = fac[i];
        // printf("x = %d\n", x);
        for (j=0; j<=i-1; j++)
        {
            a = fac[j];
            if (x%a != 0) continue;
            b = x/a;
            // printf("a = %d b = %d\n", a, b);
            //b nya bisa di-split lagi boz
            for (auto f:vc[j])
            {
                vc[i].push_back(f+b-1);
            }
        }
        sort(vc[i].begin(), vc[i].end());
        vc[i].resize(unique(vc[i].begin(), vc[i].end())-vc[i].begin());
    }
    printf("%d\n", (int)vc[fac.size()-1].size());
    for (auto x:vc[fac.size()-1]) printf("%d ", x);
    printf("\n");
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:24:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   24 |     for (i=1; i<fac.size(); i++)
      |               ~^~~~~~~~~~~
toy.cpp:13:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |     scanf("%d", &n);
      |     ~~~~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2792 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2788 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 1 ms 2772 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2796 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2792 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2788 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 1 ms 2772 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2796 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2652 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2652 KB Output is correct
33 Correct 1 ms 2652 KB Output is correct
34 Correct 1 ms 2652 KB Output is correct
35 Correct 1 ms 2728 KB Output is correct
36 Correct 1 ms 2664 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 1 ms 2736 KB Output is correct
39 Correct 2 ms 2648 KB Output is correct
40 Correct 1 ms 2652 KB Output is correct
41 Correct 1 ms 2652 KB Output is correct
42 Correct 1 ms 2792 KB Output is correct
43 Correct 1 ms 2652 KB Output is correct
44 Correct 1 ms 2652 KB Output is correct
45 Correct 1 ms 2652 KB Output is correct
46 Correct 1 ms 2652 KB Output is correct
47 Correct 1 ms 2792 KB Output is correct
48 Correct 1 ms 2648 KB Output is correct
49 Correct 2 ms 2652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2792 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2788 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 1 ms 2772 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2796 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2652 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2652 KB Output is correct
33 Correct 1 ms 2652 KB Output is correct
34 Correct 1 ms 2652 KB Output is correct
35 Correct 1 ms 2728 KB Output is correct
36 Correct 1 ms 2664 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 1 ms 2736 KB Output is correct
39 Correct 2 ms 2648 KB Output is correct
40 Correct 1 ms 2652 KB Output is correct
41 Correct 1 ms 2652 KB Output is correct
42 Correct 1 ms 2792 KB Output is correct
43 Correct 1 ms 2652 KB Output is correct
44 Correct 1 ms 2652 KB Output is correct
45 Correct 1 ms 2652 KB Output is correct
46 Correct 1 ms 2652 KB Output is correct
47 Correct 1 ms 2792 KB Output is correct
48 Correct 1 ms 2648 KB Output is correct
49 Correct 2 ms 2652 KB Output is correct
50 Correct 3 ms 2908 KB Output is correct
51 Correct 2 ms 2908 KB Output is correct
52 Correct 2 ms 2908 KB Output is correct
53 Correct 2 ms 2908 KB Output is correct
54 Correct 1 ms 2652 KB Output is correct
55 Correct 3 ms 2908 KB Output is correct
56 Correct 2 ms 2908 KB Output is correct
57 Correct 2 ms 2908 KB Output is correct
58 Correct 1 ms 2652 KB Output is correct
59 Correct 1 ms 2652 KB Output is correct
60 Correct 1 ms 2652 KB Output is correct
61 Correct 2 ms 2908 KB Output is correct
62 Correct 2 ms 2784 KB Output is correct
63 Correct 2 ms 2900 KB Output is correct
64 Correct 1 ms 2652 KB Output is correct
65 Correct 2 ms 2652 KB Output is correct
66 Correct 1 ms 2792 KB Output is correct
67 Correct 1 ms 2652 KB Output is correct
68 Correct 1 ms 2664 KB Output is correct
69 Correct 1 ms 2652 KB Output is correct
70 Correct 1 ms 2788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2792 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2788 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 1 ms 2772 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2796 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2652 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2652 KB Output is correct
33 Correct 1 ms 2652 KB Output is correct
34 Correct 1 ms 2652 KB Output is correct
35 Correct 1 ms 2728 KB Output is correct
36 Correct 1 ms 2664 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 1 ms 2736 KB Output is correct
39 Correct 2 ms 2648 KB Output is correct
40 Correct 1 ms 2652 KB Output is correct
41 Correct 1 ms 2652 KB Output is correct
42 Correct 1 ms 2792 KB Output is correct
43 Correct 1 ms 2652 KB Output is correct
44 Correct 1 ms 2652 KB Output is correct
45 Correct 1 ms 2652 KB Output is correct
46 Correct 1 ms 2652 KB Output is correct
47 Correct 1 ms 2792 KB Output is correct
48 Correct 1 ms 2648 KB Output is correct
49 Correct 2 ms 2652 KB Output is correct
50 Correct 3 ms 2908 KB Output is correct
51 Correct 2 ms 2908 KB Output is correct
52 Correct 2 ms 2908 KB Output is correct
53 Correct 2 ms 2908 KB Output is correct
54 Correct 1 ms 2652 KB Output is correct
55 Correct 3 ms 2908 KB Output is correct
56 Correct 2 ms 2908 KB Output is correct
57 Correct 2 ms 2908 KB Output is correct
58 Correct 1 ms 2652 KB Output is correct
59 Correct 1 ms 2652 KB Output is correct
60 Correct 1 ms 2652 KB Output is correct
61 Correct 2 ms 2908 KB Output is correct
62 Correct 2 ms 2784 KB Output is correct
63 Correct 2 ms 2900 KB Output is correct
64 Correct 1 ms 2652 KB Output is correct
65 Correct 2 ms 2652 KB Output is correct
66 Correct 1 ms 2792 KB Output is correct
67 Correct 1 ms 2652 KB Output is correct
68 Correct 1 ms 2664 KB Output is correct
69 Correct 1 ms 2652 KB Output is correct
70 Correct 1 ms 2788 KB Output is correct
71 Correct 148 ms 19908 KB Output is correct
72 Correct 121 ms 15528 KB Output is correct
73 Correct 146 ms 19460 KB Output is correct
74 Correct 79 ms 11716 KB Output is correct
75 Correct 93 ms 13308 KB Output is correct
76 Correct 258 ms 29448 KB Output is correct
77 Correct 213 ms 27096 KB Output is correct
78 Correct 180 ms 23480 KB Output is correct
79 Correct 196 ms 23936 KB Output is correct
80 Correct 1 ms 2652 KB Output is correct
81 Correct 1 ms 2652 KB Output is correct
82 Correct 3 ms 2908 KB Output is correct
83 Correct 22 ms 5068 KB Output is correct
84 Correct 28 ms 6104 KB Output is correct
85 Correct 6 ms 3420 KB Output is correct
86 Correct 1 ms 2652 KB Output is correct
87 Correct 31 ms 6224 KB Output is correct
88 Correct 2 ms 2796 KB Output is correct
89 Correct 1 ms 2652 KB Output is correct
90 Correct 1 ms 2808 KB Output is correct
91 Correct 8 ms 3676 KB Output is correct
92 Correct 35 ms 6480 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2652 KB Output is correct
2 Correct 1 ms 2652 KB Output is correct
3 Correct 2 ms 2652 KB Output is correct
4 Correct 1 ms 2648 KB Output is correct
5 Correct 2 ms 2652 KB Output is correct
6 Correct 1 ms 2792 KB Output is correct
7 Correct 1 ms 2652 KB Output is correct
8 Correct 1 ms 2652 KB Output is correct
9 Correct 1 ms 2788 KB Output is correct
10 Correct 1 ms 2652 KB Output is correct
11 Correct 1 ms 2652 KB Output is correct
12 Correct 1 ms 2652 KB Output is correct
13 Correct 1 ms 2652 KB Output is correct
14 Correct 1 ms 2652 KB Output is correct
15 Correct 1 ms 2652 KB Output is correct
16 Correct 1 ms 2652 KB Output is correct
17 Correct 1 ms 2772 KB Output is correct
18 Correct 1 ms 2652 KB Output is correct
19 Correct 1 ms 2648 KB Output is correct
20 Correct 1 ms 2652 KB Output is correct
21 Correct 1 ms 2652 KB Output is correct
22 Correct 1 ms 2652 KB Output is correct
23 Correct 1 ms 2796 KB Output is correct
24 Correct 1 ms 2652 KB Output is correct
25 Correct 1 ms 2652 KB Output is correct
26 Correct 2 ms 2652 KB Output is correct
27 Correct 1 ms 2652 KB Output is correct
28 Correct 1 ms 2652 KB Output is correct
29 Correct 1 ms 2652 KB Output is correct
30 Correct 1 ms 2652 KB Output is correct
31 Correct 1 ms 2652 KB Output is correct
32 Correct 1 ms 2652 KB Output is correct
33 Correct 1 ms 2652 KB Output is correct
34 Correct 1 ms 2652 KB Output is correct
35 Correct 1 ms 2728 KB Output is correct
36 Correct 1 ms 2664 KB Output is correct
37 Correct 2 ms 2652 KB Output is correct
38 Correct 1 ms 2736 KB Output is correct
39 Correct 2 ms 2648 KB Output is correct
40 Correct 1 ms 2652 KB Output is correct
41 Correct 1 ms 2652 KB Output is correct
42 Correct 1 ms 2792 KB Output is correct
43 Correct 1 ms 2652 KB Output is correct
44 Correct 1 ms 2652 KB Output is correct
45 Correct 1 ms 2652 KB Output is correct
46 Correct 1 ms 2652 KB Output is correct
47 Correct 1 ms 2792 KB Output is correct
48 Correct 1 ms 2648 KB Output is correct
49 Correct 2 ms 2652 KB Output is correct
50 Correct 3 ms 2908 KB Output is correct
51 Correct 2 ms 2908 KB Output is correct
52 Correct 2 ms 2908 KB Output is correct
53 Correct 2 ms 2908 KB Output is correct
54 Correct 1 ms 2652 KB Output is correct
55 Correct 3 ms 2908 KB Output is correct
56 Correct 2 ms 2908 KB Output is correct
57 Correct 2 ms 2908 KB Output is correct
58 Correct 1 ms 2652 KB Output is correct
59 Correct 1 ms 2652 KB Output is correct
60 Correct 1 ms 2652 KB Output is correct
61 Correct 2 ms 2908 KB Output is correct
62 Correct 2 ms 2784 KB Output is correct
63 Correct 2 ms 2900 KB Output is correct
64 Correct 1 ms 2652 KB Output is correct
65 Correct 2 ms 2652 KB Output is correct
66 Correct 1 ms 2792 KB Output is correct
67 Correct 1 ms 2652 KB Output is correct
68 Correct 1 ms 2664 KB Output is correct
69 Correct 1 ms 2652 KB Output is correct
70 Correct 1 ms 2788 KB Output is correct
71 Correct 148 ms 19908 KB Output is correct
72 Correct 121 ms 15528 KB Output is correct
73 Correct 146 ms 19460 KB Output is correct
74 Correct 79 ms 11716 KB Output is correct
75 Correct 93 ms 13308 KB Output is correct
76 Correct 258 ms 29448 KB Output is correct
77 Correct 213 ms 27096 KB Output is correct
78 Correct 180 ms 23480 KB Output is correct
79 Correct 196 ms 23936 KB Output is correct
80 Correct 1 ms 2652 KB Output is correct
81 Correct 1 ms 2652 KB Output is correct
82 Correct 3 ms 2908 KB Output is correct
83 Correct 22 ms 5068 KB Output is correct
84 Correct 28 ms 6104 KB Output is correct
85 Correct 6 ms 3420 KB Output is correct
86 Correct 1 ms 2652 KB Output is correct
87 Correct 31 ms 6224 KB Output is correct
88 Correct 2 ms 2796 KB Output is correct
89 Correct 1 ms 2652 KB Output is correct
90 Correct 1 ms 2808 KB Output is correct
91 Correct 8 ms 3676 KB Output is correct
92 Correct 35 ms 6480 KB Output is correct
93 Correct 927 ms 92876 KB Output is correct
94 Correct 449 ms 53280 KB Output is correct
95 Correct 543 ms 64760 KB Output is correct
96 Correct 448 ms 55072 KB Output is correct
97 Correct 429 ms 51580 KB Output is correct
98 Correct 1004 ms 106560 KB Output is correct
99 Correct 1051 ms 112380 KB Output is correct
100 Correct 838 ms 104588 KB Output is correct
101 Correct 816 ms 100988 KB Output is correct
102 Correct 790 ms 88768 KB Output is correct
103 Correct 627 ms 72104 KB Output is correct
104 Correct 1 ms 2652 KB Output is correct
105 Correct 1 ms 2652 KB Output is correct
106 Correct 3 ms 3004 KB Output is correct
107 Correct 72 ms 10312 KB Output is correct
108 Correct 190 ms 21832 KB Output is correct
109 Correct 16 ms 4568 KB Output is correct
110 Correct 1 ms 2652 KB Output is correct
111 Correct 85 ms 12424 KB Output is correct
112 Correct 1 ms 2652 KB Output is correct
113 Correct 1 ms 2652 KB Output is correct
114 Correct 3 ms 2908 KB Output is correct
115 Correct 1 ms 2652 KB Output is correct
116 Correct 8 ms 3420 KB Output is correct
117 Correct 167 ms 19880 KB Output is correct