Submission #599161

# Submission time Handle Problem Language Result Execution time Memory
599161 2022-07-19T11:05:52 Z jiahng Toys (CEOI18_toy) C++14
100 / 100
2200 ms 91216 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
#define ll int
typedef pair<int,int> pi;
typedef vector <int> vi;
typedef vector <pi> vpi;
typedef pair<pi, ll> pii;
typedef set <ll> si;
typedef long double ld;
#define f first
#define s second
#define mp make_pair
#define FOR(i,s,e) for(int i=s;i<=int(e);++i)
#define DEC(i,s,e) for(int i=s;i>=int(e);--i)
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define lbd(x, y) lower_bound(all(x), y)
#define ubd(x, y) upper_bound(all(x), y)
#define aFOR(i,x) for (auto i: x)
#define mem(x,i) memset(x,i,sizeof x)
#define fast ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
#define maxn 100010
#define INF (ll)(1e9+10)
#define MOD 1000000007
typedef pair <vi, int> pvi;
typedef pair <int,pi> ipi;
typedef vector <pii> vpii;
typedef pair <pi,pi> pipi;
int N;
set <int> dp[maxn];
int32_t main(){
    fast;
    cin >> N;
    vi v;
    FOR(i,2,sqrt(N)) if (N % i == 0){
        v.pb(i); v.pb(N / i);
    }        
    v.pb(N);
    
    sort(all(v)); v.erase(unique(all(v)), v.end());

    FOR(i,0,v.size()-1){
        dp[i].insert(v[i]-1);
        FOR(j,0,i-1) if (v[i] % v[j] == 0){
            aFOR(k,dp[j]) dp[i].insert(k+v[i] / v[j] - 1);
        }
    }
    cout << dp[v.size()-1].size() << '\n';
    aFOR(i,dp[v.size()-1]) cout << i << ' ';
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 5016 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 5020 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4900 KB Output is correct
10 Correct 2 ms 4948 KB Output is correct
11 Correct 2 ms 5020 KB Output is correct
12 Correct 2 ms 4948 KB Output is correct
13 Correct 4 ms 4948 KB Output is correct
14 Correct 4 ms 4948 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 5020 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 3 ms 5020 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4948 KB Output is correct
24 Correct 4 ms 4948 KB Output is correct
25 Correct 3 ms 5020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 5016 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 5020 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4900 KB Output is correct
10 Correct 2 ms 4948 KB Output is correct
11 Correct 2 ms 5020 KB Output is correct
12 Correct 2 ms 4948 KB Output is correct
13 Correct 4 ms 4948 KB Output is correct
14 Correct 4 ms 4948 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 5020 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 3 ms 5020 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4948 KB Output is correct
24 Correct 4 ms 4948 KB Output is correct
25 Correct 3 ms 5020 KB Output is correct
26 Correct 3 ms 5076 KB Output is correct
27 Correct 3 ms 5076 KB Output is correct
28 Correct 2 ms 4948 KB Output is correct
29 Correct 3 ms 4948 KB Output is correct
30 Correct 3 ms 4948 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 3 ms 5076 KB Output is correct
33 Correct 3 ms 5076 KB Output is correct
34 Correct 3 ms 4948 KB Output is correct
35 Correct 2 ms 4948 KB Output is correct
36 Correct 3 ms 4948 KB Output is correct
37 Correct 3 ms 4948 KB Output is correct
38 Correct 3 ms 5020 KB Output is correct
39 Correct 3 ms 5020 KB Output is correct
40 Correct 3 ms 4948 KB Output is correct
41 Correct 3 ms 4948 KB Output is correct
42 Correct 3 ms 5020 KB Output is correct
43 Correct 3 ms 4948 KB Output is correct
44 Correct 3 ms 4948 KB Output is correct
45 Correct 3 ms 5016 KB Output is correct
46 Correct 3 ms 4948 KB Output is correct
47 Correct 3 ms 5020 KB Output is correct
48 Correct 2 ms 5024 KB Output is correct
49 Correct 3 ms 5020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 5016 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 5020 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4900 KB Output is correct
10 Correct 2 ms 4948 KB Output is correct
11 Correct 2 ms 5020 KB Output is correct
12 Correct 2 ms 4948 KB Output is correct
13 Correct 4 ms 4948 KB Output is correct
14 Correct 4 ms 4948 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 5020 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 3 ms 5020 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4948 KB Output is correct
24 Correct 4 ms 4948 KB Output is correct
25 Correct 3 ms 5020 KB Output is correct
26 Correct 3 ms 5076 KB Output is correct
27 Correct 3 ms 5076 KB Output is correct
28 Correct 2 ms 4948 KB Output is correct
29 Correct 3 ms 4948 KB Output is correct
30 Correct 3 ms 4948 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 3 ms 5076 KB Output is correct
33 Correct 3 ms 5076 KB Output is correct
34 Correct 3 ms 4948 KB Output is correct
35 Correct 2 ms 4948 KB Output is correct
36 Correct 3 ms 4948 KB Output is correct
37 Correct 3 ms 4948 KB Output is correct
38 Correct 3 ms 5020 KB Output is correct
39 Correct 3 ms 5020 KB Output is correct
40 Correct 3 ms 4948 KB Output is correct
41 Correct 3 ms 4948 KB Output is correct
42 Correct 3 ms 5020 KB Output is correct
43 Correct 3 ms 4948 KB Output is correct
44 Correct 3 ms 4948 KB Output is correct
45 Correct 3 ms 5016 KB Output is correct
46 Correct 3 ms 4948 KB Output is correct
47 Correct 3 ms 5020 KB Output is correct
48 Correct 2 ms 5024 KB Output is correct
49 Correct 3 ms 5020 KB Output is correct
50 Correct 5 ms 5204 KB Output is correct
51 Correct 5 ms 5204 KB Output is correct
52 Correct 5 ms 5204 KB Output is correct
53 Correct 4 ms 5144 KB Output is correct
54 Correct 3 ms 5076 KB Output is correct
55 Correct 6 ms 5284 KB Output is correct
56 Correct 6 ms 5332 KB Output is correct
57 Correct 5 ms 5332 KB Output is correct
58 Correct 2 ms 4948 KB Output is correct
59 Correct 2 ms 4948 KB Output is correct
60 Correct 3 ms 5020 KB Output is correct
61 Correct 4 ms 5204 KB Output is correct
62 Correct 3 ms 5076 KB Output is correct
63 Correct 3 ms 5076 KB Output is correct
64 Correct 3 ms 4948 KB Output is correct
65 Correct 4 ms 5148 KB Output is correct
66 Correct 2 ms 4948 KB Output is correct
67 Correct 3 ms 4948 KB Output is correct
68 Correct 3 ms 5020 KB Output is correct
69 Correct 3 ms 4948 KB Output is correct
70 Correct 3 ms 5020 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 5016 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 5020 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4900 KB Output is correct
10 Correct 2 ms 4948 KB Output is correct
11 Correct 2 ms 5020 KB Output is correct
12 Correct 2 ms 4948 KB Output is correct
13 Correct 4 ms 4948 KB Output is correct
14 Correct 4 ms 4948 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 5020 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 3 ms 5020 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4948 KB Output is correct
24 Correct 4 ms 4948 KB Output is correct
25 Correct 3 ms 5020 KB Output is correct
26 Correct 3 ms 5076 KB Output is correct
27 Correct 3 ms 5076 KB Output is correct
28 Correct 2 ms 4948 KB Output is correct
29 Correct 3 ms 4948 KB Output is correct
30 Correct 3 ms 4948 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 3 ms 5076 KB Output is correct
33 Correct 3 ms 5076 KB Output is correct
34 Correct 3 ms 4948 KB Output is correct
35 Correct 2 ms 4948 KB Output is correct
36 Correct 3 ms 4948 KB Output is correct
37 Correct 3 ms 4948 KB Output is correct
38 Correct 3 ms 5020 KB Output is correct
39 Correct 3 ms 5020 KB Output is correct
40 Correct 3 ms 4948 KB Output is correct
41 Correct 3 ms 4948 KB Output is correct
42 Correct 3 ms 5020 KB Output is correct
43 Correct 3 ms 4948 KB Output is correct
44 Correct 3 ms 4948 KB Output is correct
45 Correct 3 ms 5016 KB Output is correct
46 Correct 3 ms 4948 KB Output is correct
47 Correct 3 ms 5020 KB Output is correct
48 Correct 2 ms 5024 KB Output is correct
49 Correct 3 ms 5020 KB Output is correct
50 Correct 5 ms 5204 KB Output is correct
51 Correct 5 ms 5204 KB Output is correct
52 Correct 5 ms 5204 KB Output is correct
53 Correct 4 ms 5144 KB Output is correct
54 Correct 3 ms 5076 KB Output is correct
55 Correct 6 ms 5284 KB Output is correct
56 Correct 6 ms 5332 KB Output is correct
57 Correct 5 ms 5332 KB Output is correct
58 Correct 2 ms 4948 KB Output is correct
59 Correct 2 ms 4948 KB Output is correct
60 Correct 3 ms 5020 KB Output is correct
61 Correct 4 ms 5204 KB Output is correct
62 Correct 3 ms 5076 KB Output is correct
63 Correct 3 ms 5076 KB Output is correct
64 Correct 3 ms 4948 KB Output is correct
65 Correct 4 ms 5148 KB Output is correct
66 Correct 2 ms 4948 KB Output is correct
67 Correct 3 ms 4948 KB Output is correct
68 Correct 3 ms 5020 KB Output is correct
69 Correct 3 ms 4948 KB Output is correct
70 Correct 3 ms 5020 KB Output is correct
71 Correct 312 ms 23244 KB Output is correct
72 Correct 213 ms 18676 KB Output is correct
73 Correct 286 ms 21052 KB Output is correct
74 Correct 159 ms 15820 KB Output is correct
75 Correct 182 ms 16548 KB Output is correct
76 Correct 498 ms 29584 KB Output is correct
77 Correct 464 ms 26572 KB Output is correct
78 Correct 390 ms 25256 KB Output is correct
79 Correct 374 ms 24692 KB Output is correct
80 Correct 3 ms 4948 KB Output is correct
81 Correct 4 ms 4948 KB Output is correct
82 Correct 5 ms 5288 KB Output is correct
83 Correct 46 ms 8228 KB Output is correct
84 Correct 54 ms 9068 KB Output is correct
85 Correct 13 ms 6228 KB Output is correct
86 Correct 3 ms 4948 KB Output is correct
87 Correct 57 ms 9676 KB Output is correct
88 Correct 3 ms 4948 KB Output is correct
89 Correct 3 ms 4948 KB Output is correct
90 Correct 3 ms 4948 KB Output is correct
91 Correct 18 ms 6740 KB Output is correct
92 Correct 70 ms 11160 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 4948 KB Output is correct
2 Correct 3 ms 5016 KB Output is correct
3 Correct 3 ms 4948 KB Output is correct
4 Correct 3 ms 4948 KB Output is correct
5 Correct 2 ms 5020 KB Output is correct
6 Correct 3 ms 4948 KB Output is correct
7 Correct 2 ms 4948 KB Output is correct
8 Correct 2 ms 4948 KB Output is correct
9 Correct 3 ms 4900 KB Output is correct
10 Correct 2 ms 4948 KB Output is correct
11 Correct 2 ms 5020 KB Output is correct
12 Correct 2 ms 4948 KB Output is correct
13 Correct 4 ms 4948 KB Output is correct
14 Correct 4 ms 4948 KB Output is correct
15 Correct 3 ms 4948 KB Output is correct
16 Correct 3 ms 4948 KB Output is correct
17 Correct 4 ms 4948 KB Output is correct
18 Correct 3 ms 4948 KB Output is correct
19 Correct 3 ms 5020 KB Output is correct
20 Correct 3 ms 4948 KB Output is correct
21 Correct 3 ms 5020 KB Output is correct
22 Correct 3 ms 4948 KB Output is correct
23 Correct 3 ms 4948 KB Output is correct
24 Correct 4 ms 4948 KB Output is correct
25 Correct 3 ms 5020 KB Output is correct
26 Correct 3 ms 5076 KB Output is correct
27 Correct 3 ms 5076 KB Output is correct
28 Correct 2 ms 4948 KB Output is correct
29 Correct 3 ms 4948 KB Output is correct
30 Correct 3 ms 4948 KB Output is correct
31 Correct 3 ms 5076 KB Output is correct
32 Correct 3 ms 5076 KB Output is correct
33 Correct 3 ms 5076 KB Output is correct
34 Correct 3 ms 4948 KB Output is correct
35 Correct 2 ms 4948 KB Output is correct
36 Correct 3 ms 4948 KB Output is correct
37 Correct 3 ms 4948 KB Output is correct
38 Correct 3 ms 5020 KB Output is correct
39 Correct 3 ms 5020 KB Output is correct
40 Correct 3 ms 4948 KB Output is correct
41 Correct 3 ms 4948 KB Output is correct
42 Correct 3 ms 5020 KB Output is correct
43 Correct 3 ms 4948 KB Output is correct
44 Correct 3 ms 4948 KB Output is correct
45 Correct 3 ms 5016 KB Output is correct
46 Correct 3 ms 4948 KB Output is correct
47 Correct 3 ms 5020 KB Output is correct
48 Correct 2 ms 5024 KB Output is correct
49 Correct 3 ms 5020 KB Output is correct
50 Correct 5 ms 5204 KB Output is correct
51 Correct 5 ms 5204 KB Output is correct
52 Correct 5 ms 5204 KB Output is correct
53 Correct 4 ms 5144 KB Output is correct
54 Correct 3 ms 5076 KB Output is correct
55 Correct 6 ms 5284 KB Output is correct
56 Correct 6 ms 5332 KB Output is correct
57 Correct 5 ms 5332 KB Output is correct
58 Correct 2 ms 4948 KB Output is correct
59 Correct 2 ms 4948 KB Output is correct
60 Correct 3 ms 5020 KB Output is correct
61 Correct 4 ms 5204 KB Output is correct
62 Correct 3 ms 5076 KB Output is correct
63 Correct 3 ms 5076 KB Output is correct
64 Correct 3 ms 4948 KB Output is correct
65 Correct 4 ms 5148 KB Output is correct
66 Correct 2 ms 4948 KB Output is correct
67 Correct 3 ms 4948 KB Output is correct
68 Correct 3 ms 5020 KB Output is correct
69 Correct 3 ms 4948 KB Output is correct
70 Correct 3 ms 5020 KB Output is correct
71 Correct 312 ms 23244 KB Output is correct
72 Correct 213 ms 18676 KB Output is correct
73 Correct 286 ms 21052 KB Output is correct
74 Correct 159 ms 15820 KB Output is correct
75 Correct 182 ms 16548 KB Output is correct
76 Correct 498 ms 29584 KB Output is correct
77 Correct 464 ms 26572 KB Output is correct
78 Correct 390 ms 25256 KB Output is correct
79 Correct 374 ms 24692 KB Output is correct
80 Correct 3 ms 4948 KB Output is correct
81 Correct 4 ms 4948 KB Output is correct
82 Correct 5 ms 5288 KB Output is correct
83 Correct 46 ms 8228 KB Output is correct
84 Correct 54 ms 9068 KB Output is correct
85 Correct 13 ms 6228 KB Output is correct
86 Correct 3 ms 4948 KB Output is correct
87 Correct 57 ms 9676 KB Output is correct
88 Correct 3 ms 4948 KB Output is correct
89 Correct 3 ms 4948 KB Output is correct
90 Correct 3 ms 4948 KB Output is correct
91 Correct 18 ms 6740 KB Output is correct
92 Correct 70 ms 11160 KB Output is correct
93 Correct 1881 ms 82064 KB Output is correct
94 Correct 995 ms 56672 KB Output is correct
95 Correct 1184 ms 59332 KB Output is correct
96 Correct 1044 ms 53512 KB Output is correct
97 Correct 938 ms 49044 KB Output is correct
98 Correct 2117 ms 89832 KB Output is correct
99 Correct 2200 ms 91216 KB Output is correct
100 Correct 2090 ms 87884 KB Output is correct
101 Correct 1970 ms 81860 KB Output is correct
102 Correct 1699 ms 74200 KB Output is correct
103 Correct 1353 ms 67292 KB Output is correct
104 Correct 3 ms 4948 KB Output is correct
105 Correct 3 ms 5016 KB Output is correct
106 Correct 7 ms 5588 KB Output is correct
107 Correct 137 ms 14156 KB Output is correct
108 Correct 355 ms 25016 KB Output is correct
109 Correct 30 ms 7880 KB Output is correct
110 Correct 3 ms 4948 KB Output is correct
111 Correct 170 ms 16792 KB Output is correct
112 Correct 3 ms 4948 KB Output is correct
113 Correct 3 ms 4948 KB Output is correct
114 Correct 6 ms 5588 KB Output is correct
115 Correct 3 ms 4948 KB Output is correct
116 Correct 12 ms 6356 KB Output is correct
117 Correct 337 ms 29248 KB Output is correct