Submission #406149

# Submission time Handle Problem Language Result Execution time Memory
406149 2021-05-17T08:49:56 Z abdzag Toys (CEOI18_toy) C++17
100 / 100
3544 ms 93996 KB
#include<bits/stdc++.h>
#include<unordered_map>
#define rep(i,a,b) for(int i=int(a);i<int(b);i++)
#define rrep(i,a,b) for(int i=int(a);i>int(b);i--)
#define all(v) v.begin(),v.end()
#define trav(a,v) for(auto&a:v)
#define  sz(a) a.size()
typedef long double ld;
using namespace std;
const long long inf = 1e15;
typedef long long ll;
typedef unsigned long long ull;
map<ll, set<ll>> dp;
set<ll> solve(ll left) {
	if (dp[left].size())return dp[left];
	set<ll> ans;
	rep(i, 2, sqrt(left) + 4) {
		if (left % i == 0) {
			set<ll> s = solve(left / i);
			trav(a, s)ans.insert(a - 1 + i);
		}
	}
	ans.insert(left - 1);
	return dp[left] = ans;
}
int main() {
	cin.sync_with_stdio(false);
	ll n;
	cin >> n;
	set<ll> res = solve(n);
	cout << res.size() << endl;
	trav(a, res)cout << a << " ";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 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 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 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 2 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 276 KB Output is correct
21 Correct 1 ms 316 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 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 2 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 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 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 2 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 276 KB Output is correct
21 Correct 1 ms 316 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 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 2 ms 312 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 312 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 332 KB Output is correct
37 Correct 2 ms 312 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 2 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 2 ms 332 KB Output is correct
46 Correct 1 ms 312 KB Output is correct
47 Correct 2 ms 312 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 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 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 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 2 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 276 KB Output is correct
21 Correct 1 ms 316 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 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 2 ms 312 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 312 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 332 KB Output is correct
37 Correct 2 ms 312 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 2 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 2 ms 332 KB Output is correct
46 Correct 1 ms 312 KB Output is correct
47 Correct 2 ms 312 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 5 ms 588 KB Output is correct
52 Correct 4 ms 588 KB Output is correct
53 Correct 4 ms 588 KB Output is correct
54 Correct 2 ms 460 KB Output is correct
55 Correct 7 ms 692 KB Output is correct
56 Correct 6 ms 716 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 312 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 388 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 460 KB Output is correct
66 Correct 2 ms 312 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 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 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 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 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 2 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 276 KB Output is correct
21 Correct 1 ms 316 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 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 2 ms 312 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 312 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 332 KB Output is correct
37 Correct 2 ms 312 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 2 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 2 ms 332 KB Output is correct
46 Correct 1 ms 312 KB Output is correct
47 Correct 2 ms 312 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 5 ms 588 KB Output is correct
52 Correct 4 ms 588 KB Output is correct
53 Correct 4 ms 588 KB Output is correct
54 Correct 2 ms 460 KB Output is correct
55 Correct 7 ms 692 KB Output is correct
56 Correct 6 ms 716 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 312 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 388 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 460 KB Output is correct
66 Correct 2 ms 312 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 2 ms 332 KB Output is correct
71 Correct 605 ms 20416 KB Output is correct
72 Correct 347 ms 15644 KB Output is correct
73 Correct 447 ms 18152 KB Output is correct
74 Correct 277 ms 12360 KB Output is correct
75 Correct 334 ms 13256 KB Output is correct
76 Correct 815 ms 27296 KB Output is correct
77 Correct 769 ms 24068 KB Output is correct
78 Correct 617 ms 22680 KB Output is correct
79 Correct 571 ms 22076 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 716 KB Output is correct
83 Correct 96 ms 4172 KB Output is correct
84 Correct 94 ms 5140 KB Output is correct
85 Correct 19 ms 1868 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 91 ms 5752 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 2 ms 332 KB Output is correct
91 Correct 26 ms 2520 KB Output is correct
92 Correct 113 ms 7648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 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 308 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 2 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 2 ms 204 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 276 KB Output is correct
21 Correct 1 ms 316 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 2 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 2 ms 312 KB Output is correct
29 Correct 1 ms 332 KB Output is correct
30 Correct 1 ms 312 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 332 KB Output is correct
37 Correct 2 ms 312 KB Output is correct
38 Correct 1 ms 332 KB Output is correct
39 Correct 1 ms 204 KB Output is correct
40 Correct 2 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 2 ms 332 KB Output is correct
46 Correct 1 ms 312 KB Output is correct
47 Correct 2 ms 312 KB Output is correct
48 Correct 1 ms 204 KB Output is correct
49 Correct 1 ms 332 KB Output is correct
50 Correct 5 ms 588 KB Output is correct
51 Correct 5 ms 588 KB Output is correct
52 Correct 4 ms 588 KB Output is correct
53 Correct 4 ms 588 KB Output is correct
54 Correct 2 ms 460 KB Output is correct
55 Correct 7 ms 692 KB Output is correct
56 Correct 6 ms 716 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 312 KB Output is correct
61 Correct 3 ms 460 KB Output is correct
62 Correct 2 ms 388 KB Output is correct
63 Correct 1 ms 332 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 3 ms 460 KB Output is correct
66 Correct 2 ms 312 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 2 ms 332 KB Output is correct
71 Correct 605 ms 20416 KB Output is correct
72 Correct 347 ms 15644 KB Output is correct
73 Correct 447 ms 18152 KB Output is correct
74 Correct 277 ms 12360 KB Output is correct
75 Correct 334 ms 13256 KB Output is correct
76 Correct 815 ms 27296 KB Output is correct
77 Correct 769 ms 24068 KB Output is correct
78 Correct 617 ms 22680 KB Output is correct
79 Correct 571 ms 22076 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 716 KB Output is correct
83 Correct 96 ms 4172 KB Output is correct
84 Correct 94 ms 5140 KB Output is correct
85 Correct 19 ms 1868 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 91 ms 5752 KB Output is correct
88 Correct 1 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 2 ms 332 KB Output is correct
91 Correct 26 ms 2520 KB Output is correct
92 Correct 113 ms 7648 KB Output is correct
93 Correct 2902 ms 83896 KB Output is correct
94 Correct 1631 ms 57300 KB Output is correct
95 Correct 1856 ms 59932 KB Output is correct
96 Correct 1633 ms 53328 KB Output is correct
97 Correct 1481 ms 48456 KB Output is correct
98 Correct 3346 ms 92564 KB Output is correct
99 Correct 3544 ms 93996 KB Output is correct
100 Correct 3312 ms 90320 KB Output is correct
101 Correct 3050 ms 83860 KB Output is correct
102 Correct 2675 ms 75692 KB Output is correct
103 Correct 2208 ms 68256 KB Output is correct
104 Correct 1 ms 256 KB Output is correct
105 Correct 1 ms 316 KB Output is correct
106 Correct 9 ms 1100 KB Output is correct
107 Correct 212 ms 11060 KB Output is correct
108 Correct 559 ms 23096 KB Output is correct
109 Correct 51 ms 3908 KB Output is correct
110 Correct 2 ms 316 KB Output is correct
111 Correct 275 ms 13940 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 204 KB Output is correct
114 Correct 10 ms 1100 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 20 ms 2104 KB Output is correct
117 Correct 554 ms 28032 KB Output is correct