Submission #958628

# Submission time Handle Problem Language Result Execution time Memory
958628 2024-04-06T08:28:33 Z LucaIlie Toys (CEOI18_toy) C++17
100 / 100
1101 ms 112136 KB
#include <bits/stdc++.h>

using namespace std;

const int MAX_DIVS = 10000;
vector<int> divs;
vector<int> sol[MAX_DIVS];

int main() {
    int n;

    cin >> n;

    for ( int d = 1; d * d <= n; d++ ) {
        if ( n % d == 0 ) {
            divs.push_back( d );
            if ( d != n / d )
                divs.push_back( n / d );
        }
    }

    sort( divs.begin(), divs.end() );

    sol[0].push_back( 0 );
    for ( int i = 1; i < divs.size(); i++ ) {
        int a = divs[i];
        for ( int j = 0; j < i; j++ ) {
            int b = divs[j];
            if ( a % b != 0 )
                continue;

            for ( int x: sol[j] )
                sol[i].push_back( x + a / b - 1 );
        }

        sort( sol[i].begin(), sol[i].end() );
        sol[i].resize( unique( sol[i].begin(), sol[i].end() ) - sol[i].begin() );
    }

    cout << sol[divs.size() - 1].size() << "\n";
    for ( int x: sol[divs.size() - 1] )
        cout << x  << " ";

    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:25:24: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for ( int i = 1; i < divs.size(); i++ ) {
      |                      ~~^~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 0 ms 604 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 428 KB Output is correct
45 Correct 1 ms 672 KB Output is correct
46 Correct 0 ms 600 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 1 ms 792 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 0 ms 604 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 428 KB Output is correct
45 Correct 1 ms 672 KB Output is correct
46 Correct 0 ms 600 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 1 ms 792 KB Output is correct
50 Correct 2 ms 856 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 1 ms 604 KB Output is correct
53 Correct 2 ms 860 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 2 ms 860 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 2 ms 860 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 0 ms 604 KB Output is correct
60 Correct 0 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 0 ms 604 KB Output is correct
67 Correct 0 ms 604 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 0 ms 604 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 428 KB Output is correct
45 Correct 1 ms 672 KB Output is correct
46 Correct 0 ms 600 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 1 ms 792 KB Output is correct
50 Correct 2 ms 856 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 1 ms 604 KB Output is correct
53 Correct 2 ms 860 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 2 ms 860 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 2 ms 860 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 0 ms 604 KB Output is correct
60 Correct 0 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 0 ms 604 KB Output is correct
67 Correct 0 ms 604 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 161 ms 18000 KB Output is correct
72 Correct 112 ms 13256 KB Output is correct
73 Correct 148 ms 17540 KB Output is correct
74 Correct 82 ms 9632 KB Output is correct
75 Correct 103 ms 11100 KB Output is correct
76 Correct 247 ms 27196 KB Output is correct
77 Correct 223 ms 25028 KB Output is correct
78 Correct 198 ms 21340 KB Output is correct
79 Correct 189 ms 21768 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 0 ms 604 KB Output is correct
82 Correct 2 ms 600 KB Output is correct
83 Correct 27 ms 3028 KB Output is correct
84 Correct 28 ms 4056 KB Output is correct
85 Correct 6 ms 1372 KB Output is correct
86 Correct 1 ms 600 KB Output is correct
87 Correct 30 ms 4048 KB Output is correct
88 Correct 0 ms 600 KB Output is correct
89 Correct 0 ms 604 KB Output is correct
90 Correct 1 ms 604 KB Output is correct
91 Correct 8 ms 1588 KB Output is correct
92 Correct 35 ms 4472 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 604 KB Output is correct
2 Correct 1 ms 604 KB Output is correct
3 Correct 0 ms 604 KB Output is correct
4 Correct 0 ms 604 KB Output is correct
5 Correct 0 ms 604 KB Output is correct
6 Correct 1 ms 604 KB Output is correct
7 Correct 0 ms 856 KB Output is correct
8 Correct 1 ms 600 KB Output is correct
9 Correct 0 ms 600 KB Output is correct
10 Correct 0 ms 604 KB Output is correct
11 Correct 0 ms 604 KB Output is correct
12 Correct 1 ms 604 KB Output is correct
13 Correct 1 ms 600 KB Output is correct
14 Correct 1 ms 604 KB Output is correct
15 Correct 1 ms 604 KB Output is correct
16 Correct 0 ms 604 KB Output is correct
17 Correct 0 ms 604 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 604 KB Output is correct
20 Correct 0 ms 604 KB Output is correct
21 Correct 0 ms 604 KB Output is correct
22 Correct 1 ms 604 KB Output is correct
23 Correct 0 ms 604 KB Output is correct
24 Correct 1 ms 604 KB Output is correct
25 Correct 0 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 600 KB Output is correct
29 Correct 1 ms 604 KB Output is correct
30 Correct 0 ms 604 KB Output is correct
31 Correct 1 ms 604 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 0 ms 604 KB Output is correct
35 Correct 0 ms 604 KB Output is correct
36 Correct 0 ms 604 KB Output is correct
37 Correct 1 ms 604 KB Output is correct
38 Correct 0 ms 604 KB Output is correct
39 Correct 0 ms 604 KB Output is correct
40 Correct 1 ms 604 KB Output is correct
41 Correct 0 ms 604 KB Output is correct
42 Correct 0 ms 604 KB Output is correct
43 Correct 0 ms 604 KB Output is correct
44 Correct 1 ms 428 KB Output is correct
45 Correct 1 ms 672 KB Output is correct
46 Correct 0 ms 600 KB Output is correct
47 Correct 1 ms 604 KB Output is correct
48 Correct 0 ms 604 KB Output is correct
49 Correct 1 ms 792 KB Output is correct
50 Correct 2 ms 856 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 1 ms 604 KB Output is correct
53 Correct 2 ms 860 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 2 ms 860 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 2 ms 860 KB Output is correct
58 Correct 0 ms 604 KB Output is correct
59 Correct 0 ms 604 KB Output is correct
60 Correct 0 ms 604 KB Output is correct
61 Correct 1 ms 604 KB Output is correct
62 Correct 1 ms 604 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 604 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 0 ms 604 KB Output is correct
67 Correct 0 ms 604 KB Output is correct
68 Correct 0 ms 604 KB Output is correct
69 Correct 0 ms 604 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 161 ms 18000 KB Output is correct
72 Correct 112 ms 13256 KB Output is correct
73 Correct 148 ms 17540 KB Output is correct
74 Correct 82 ms 9632 KB Output is correct
75 Correct 103 ms 11100 KB Output is correct
76 Correct 247 ms 27196 KB Output is correct
77 Correct 223 ms 25028 KB Output is correct
78 Correct 198 ms 21340 KB Output is correct
79 Correct 189 ms 21768 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 0 ms 604 KB Output is correct
82 Correct 2 ms 600 KB Output is correct
83 Correct 27 ms 3028 KB Output is correct
84 Correct 28 ms 4056 KB Output is correct
85 Correct 6 ms 1372 KB Output is correct
86 Correct 1 ms 600 KB Output is correct
87 Correct 30 ms 4048 KB Output is correct
88 Correct 0 ms 600 KB Output is correct
89 Correct 0 ms 604 KB Output is correct
90 Correct 1 ms 604 KB Output is correct
91 Correct 8 ms 1588 KB Output is correct
92 Correct 35 ms 4472 KB Output is correct
93 Correct 923 ms 90896 KB Output is correct
94 Correct 494 ms 53252 KB Output is correct
95 Correct 584 ms 63112 KB Output is correct
96 Correct 501 ms 53652 KB Output is correct
97 Correct 478 ms 49396 KB Output is correct
98 Correct 1002 ms 110284 KB Output is correct
99 Correct 1101 ms 112136 KB Output is correct
100 Correct 995 ms 103992 KB Output is correct
101 Correct 950 ms 101276 KB Output is correct
102 Correct 861 ms 90432 KB Output is correct
103 Correct 655 ms 70576 KB Output is correct
104 Correct 1 ms 600 KB Output is correct
105 Correct 1 ms 604 KB Output is correct
106 Correct 3 ms 860 KB Output is correct
107 Correct 71 ms 8164 KB Output is correct
108 Correct 175 ms 19572 KB Output is correct
109 Correct 15 ms 2264 KB Output is correct
110 Correct 1 ms 600 KB Output is correct
111 Correct 92 ms 10460 KB Output is correct
112 Correct 1 ms 604 KB Output is correct
113 Correct 1 ms 604 KB Output is correct
114 Correct 3 ms 860 KB Output is correct
115 Correct 1 ms 604 KB Output is correct
116 Correct 6 ms 1324 KB Output is correct
117 Correct 167 ms 17740 KB Output is correct