Submission #405410

# Submission time Handle Problem Language Result Execution time Memory
405410 2021-05-16T11:12:12 Z ollel Toys (CEOI18_toy) C++14
100 / 100
4441 ms 91012 KB
#include <bits/stdc++.h>
#include <iostream>
using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef vector<vi> vvi;

#define rep(i,a,b) for(int i = a; i < b; i++)
#define pb push_back

int n;
map<int, vi> d;
map<int, set<int>> dp;


void getd(){
  set<int> divs;
  rep(i, 1, sqrt(n) + 4) {
    if (n % i == 0) {divs.insert(i); divs.insert(n / i);}
  }

  for (auto &i : divs) {
    dp.insert({i, {}});
    d.insert({i, vi(0)});
  }

  for (auto &i : divs){
    for (auto &j : divs){
      if (j % i == 0) {
        d[j].pb(i);
      }
    }
  }
}

set<int> get(int x) {
  if (!(dp[x].empty())) return dp[x];

  dp[x].insert(x - 1);
  for (auto &y : d[x]) {
    for (auto &k : get(x/y)) {
      dp[x].insert(k + y - 1);
    }
  }
  return dp[x];
}

int main(){
  cin >> n;
  getd();
  set<int> ans = get(n);
  cout << ans.size() << endl;
  for (auto &i : ans) cout << i << " "; cout<<endl;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:54:3: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   54 |   for (auto &i : ans) cout << i << " "; cout<<endl;
      |   ^~~
toy.cpp:54:41: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   54 |   for (auto &i : ans) cout << i << " "; cout<<endl;
      |                                         ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 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 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 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 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 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 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 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 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 2 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 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 1 ms 204 KB Output is correct
42 Correct 1 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 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 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 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 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 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 2 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 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 1 ms 204 KB Output is correct
42 Correct 1 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 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 6 ms 560 KB Output is correct
52 Correct 5 ms 588 KB Output is correct
53 Correct 4 ms 460 KB Output is correct
54 Correct 3 ms 460 KB Output is correct
55 Correct 7 ms 716 KB Output is correct
56 Correct 7 ms 588 KB Output is correct
57 Correct 6 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 4 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 2 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 4 ms 556 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 3 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 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 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 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 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 2 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 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 1 ms 204 KB Output is correct
42 Correct 1 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 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 6 ms 560 KB Output is correct
52 Correct 5 ms 588 KB Output is correct
53 Correct 4 ms 460 KB Output is correct
54 Correct 3 ms 460 KB Output is correct
55 Correct 7 ms 716 KB Output is correct
56 Correct 7 ms 588 KB Output is correct
57 Correct 6 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 4 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 2 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 4 ms 556 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 3 ms 332 KB Output is correct
71 Correct 599 ms 19740 KB Output is correct
72 Correct 389 ms 15128 KB Output is correct
73 Correct 557 ms 17596 KB Output is correct
74 Correct 297 ms 11900 KB Output is correct
75 Correct 344 ms 12708 KB Output is correct
76 Correct 950 ms 26388 KB Output is correct
77 Correct 908 ms 23492 KB Output is correct
78 Correct 779 ms 21900 KB Output is correct
79 Correct 718 ms 21320 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 1 ms 204 KB Output is correct
82 Correct 6 ms 588 KB Output is correct
83 Correct 72 ms 3916 KB Output is correct
84 Correct 96 ms 4756 KB Output is correct
85 Correct 20 ms 1680 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 108 ms 5432 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 332 KB Output is correct
91 Correct 29 ms 2372 KB Output is correct
92 Correct 129 ms 7240 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 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 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 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 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 256 KB Output is correct
19 Correct 1 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 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 2 ms 332 KB Output is correct
27 Correct 2 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 2 ms 332 KB Output is correct
32 Correct 2 ms 332 KB Output is correct
33 Correct 2 ms 332 KB Output is correct
34 Correct 1 ms 204 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 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 1 ms 204 KB Output is correct
42 Correct 1 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 1 ms 204 KB Output is correct
49 Correct 1 ms 204 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 6 ms 560 KB Output is correct
52 Correct 5 ms 588 KB Output is correct
53 Correct 4 ms 460 KB Output is correct
54 Correct 3 ms 460 KB Output is correct
55 Correct 7 ms 716 KB Output is correct
56 Correct 7 ms 588 KB Output is correct
57 Correct 6 ms 588 KB Output is correct
58 Correct 1 ms 204 KB Output is correct
59 Correct 1 ms 204 KB Output is correct
60 Correct 1 ms 332 KB Output is correct
61 Correct 4 ms 460 KB Output is correct
62 Correct 2 ms 332 KB Output is correct
63 Correct 2 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 4 ms 556 KB Output is correct
66 Correct 1 ms 204 KB Output is correct
67 Correct 1 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 332 KB Output is correct
70 Correct 3 ms 332 KB Output is correct
71 Correct 599 ms 19740 KB Output is correct
72 Correct 389 ms 15128 KB Output is correct
73 Correct 557 ms 17596 KB Output is correct
74 Correct 297 ms 11900 KB Output is correct
75 Correct 344 ms 12708 KB Output is correct
76 Correct 950 ms 26388 KB Output is correct
77 Correct 908 ms 23492 KB Output is correct
78 Correct 779 ms 21900 KB Output is correct
79 Correct 718 ms 21320 KB Output is correct
80 Correct 1 ms 204 KB Output is correct
81 Correct 1 ms 204 KB Output is correct
82 Correct 6 ms 588 KB Output is correct
83 Correct 72 ms 3916 KB Output is correct
84 Correct 96 ms 4756 KB Output is correct
85 Correct 20 ms 1680 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 108 ms 5432 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 332 KB Output is correct
91 Correct 29 ms 2372 KB Output is correct
92 Correct 129 ms 7240 KB Output is correct
93 Correct 3736 ms 81476 KB Output is correct
94 Correct 2087 ms 55296 KB Output is correct
95 Correct 2270 ms 57876 KB Output is correct
96 Correct 2031 ms 51720 KB Output is correct
97 Correct 1916 ms 47164 KB Output is correct
98 Correct 4371 ms 89736 KB Output is correct
99 Correct 4441 ms 91012 KB Output is correct
100 Correct 4050 ms 87592 KB Output is correct
101 Correct 3947 ms 81072 KB Output is correct
102 Correct 3570 ms 72976 KB Output is correct
103 Correct 2738 ms 65820 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 11 ms 972 KB Output is correct
107 Correct 268 ms 10312 KB Output is correct
108 Correct 660 ms 21964 KB Output is correct
109 Correct 66 ms 3484 KB Output is correct
110 Correct 1 ms 204 KB Output is correct
111 Correct 312 ms 13188 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 204 KB Output is correct
114 Correct 11 ms 996 KB Output is correct
115 Correct 1 ms 288 KB Output is correct
116 Correct 20 ms 1884 KB Output is correct
117 Correct 649 ms 26600 KB Output is correct