Submission #480734

# Submission time Handle Problem Language Result Execution time Memory
480734 2021-10-18T01:53:27 Z wiwiho Toys (CEOI18_toy) C++14
100 / 100
1400 ms 128876 KB
#include<bits/stdc++.h>

#define eb emplace_back
#define iter(a) a.begin(), a.end()
#define lsort(a) sort(iter(a))
#define uni(a) a.resize(unique(iter(a)) - a.begin())
#define printv(a, b) {\
    for(auto pv : a) b << pv << " ";\
    b << "\n";\
}

using namespace std;

typedef long long ll;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n;
    cin >> n;

    vector<int> f;
    for(int i = 1; (ll)i * i <= n; i++){
        if(n % i) continue;
        f.eb(i);
        if(n / i != i) f.eb(n / i);
    }

    lsort(f);

    int m = f.size();
    vector<vector<int>> dp(m);

    dp[0].eb(0);

    for(int i = 0; i < m; i++){
        int now = f[i];
        lsort(dp[i]);
        uni(dp[i]);
        for(int j : f){
            if(j == 1) continue;
            if(n % ((ll)now * j)) continue;
            int id = lower_bound(iter(f), now * j) - f.begin();
            for(int k : dp[i]) dp[id].eb(k + j - 1);
        }
    }

    cout << dp[m - 1].size() << "\n";
    printv(dp[m - 1], cout);

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 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 1 ms 204 KB Output is correct
30 Correct 1 ms 280 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 1 ms 204 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 312 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 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 1 ms 204 KB Output is correct
30 Correct 1 ms 280 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 1 ms 204 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 312 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 2 ms 460 KB Output is correct
53 Correct 2 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 3 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 3 ms 568 KB Output is correct
58 Correct 1 ms 312 KB Output is correct
59 Correct 1 ms 204 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 312 KB Output is correct
64 Correct 0 ms 312 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 0 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 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 1 ms 204 KB Output is correct
30 Correct 1 ms 280 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 1 ms 204 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 312 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 2 ms 460 KB Output is correct
53 Correct 2 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 3 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 3 ms 568 KB Output is correct
58 Correct 1 ms 312 KB Output is correct
59 Correct 1 ms 204 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 312 KB Output is correct
64 Correct 0 ms 312 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 0 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 200 ms 20528 KB Output is correct
72 Correct 138 ms 14356 KB Output is correct
73 Correct 192 ms 19224 KB Output is correct
74 Correct 110 ms 10536 KB Output is correct
75 Correct 123 ms 12524 KB Output is correct
76 Correct 313 ms 31048 KB Output is correct
77 Correct 293 ms 28916 KB Output is correct
78 Correct 246 ms 24956 KB Output is correct
79 Correct 252 ms 25428 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 1 ms 308 KB Output is correct
82 Correct 2 ms 460 KB Output is correct
83 Correct 27 ms 3300 KB Output is correct
84 Correct 36 ms 4160 KB Output is correct
85 Correct 8 ms 1204 KB Output is correct
86 Correct 1 ms 204 KB Output is correct
87 Correct 40 ms 4256 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 204 KB Output is correct
91 Correct 11 ms 1328 KB Output is correct
92 Correct 48 ms 4984 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 1 ms 308 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 0 ms 204 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 1 ms 204 KB Output is correct
30 Correct 1 ms 280 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 1 ms 204 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 312 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 204 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 1 ms 204 KB Output is correct
44 Correct 1 ms 204 KB Output is correct
45 Correct 1 ms 204 KB Output is correct
46 Correct 1 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 2 ms 460 KB Output is correct
51 Correct 2 ms 460 KB Output is correct
52 Correct 2 ms 460 KB Output is correct
53 Correct 2 ms 460 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 3 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 3 ms 568 KB Output is correct
58 Correct 1 ms 312 KB Output is correct
59 Correct 1 ms 204 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 312 KB Output is correct
64 Correct 0 ms 312 KB Output is correct
65 Correct 1 ms 332 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 0 ms 204 KB Output is correct
69 Correct 1 ms 204 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 200 ms 20528 KB Output is correct
72 Correct 138 ms 14356 KB Output is correct
73 Correct 192 ms 19224 KB Output is correct
74 Correct 110 ms 10536 KB Output is correct
75 Correct 123 ms 12524 KB Output is correct
76 Correct 313 ms 31048 KB Output is correct
77 Correct 293 ms 28916 KB Output is correct
78 Correct 246 ms 24956 KB Output is correct
79 Correct 252 ms 25428 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 1 ms 308 KB Output is correct
82 Correct 2 ms 460 KB Output is correct
83 Correct 27 ms 3300 KB Output is correct
84 Correct 36 ms 4160 KB Output is correct
85 Correct 8 ms 1204 KB Output is correct
86 Correct 1 ms 204 KB Output is correct
87 Correct 40 ms 4256 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 204 KB Output is correct
91 Correct 11 ms 1328 KB Output is correct
92 Correct 48 ms 4984 KB Output is correct
93 Correct 1135 ms 109032 KB Output is correct
94 Correct 616 ms 56756 KB Output is correct
95 Correct 733 ms 72412 KB Output is correct
96 Correct 675 ms 62828 KB Output is correct
97 Correct 616 ms 58200 KB Output is correct
98 Correct 1326 ms 125264 KB Output is correct
99 Correct 1400 ms 128876 KB Output is correct
100 Correct 1291 ms 124012 KB Output is correct
101 Correct 1251 ms 117672 KB Output is correct
102 Correct 1085 ms 106208 KB Output is correct
103 Correct 843 ms 85308 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 4 ms 660 KB Output is correct
107 Correct 89 ms 9008 KB Output is correct
108 Correct 229 ms 20516 KB Output is correct
109 Correct 19 ms 2384 KB Output is correct
110 Correct 1 ms 204 KB Output is correct
111 Correct 111 ms 10332 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 204 KB Output is correct
114 Correct 4 ms 588 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 7 ms 1100 KB Output is correct
117 Correct 219 ms 20168 KB Output is correct