Submission #406321

# Submission time Handle Problem Language Result Execution time Memory
406321 2021-05-17T11:25:43 Z abdzag Toys (CEOI18_toy) C++17
79 / 100
1371 ms 262148 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;
int main() {
	cin.sync_with_stdio(false);
	vector<ll> primes;
	map<ll, bool> is_prime;
	primes.push_back(2);
	rep(i, 3, 1e5) {
		ll val = sqrt(i);
		val++;
		ll ind = upper_bound(all(primes), val) - primes.begin();
		bool done = true;
		rep(j, 0, ind) {
			if (i % primes[j] == 0) {
				done = false;
				break;
			}
		}
		if (done) {
			is_prime[i] = 1;
			primes.push_back(i);
		}
	}
	ll n;
	cin >> n;
	ll cur = n;
	vector<ll> v;
	rep(i, 0, primes.size()) {
		if (cur % primes[i] == 0) {
			v.push_back(primes[i]);
			cur /= primes[i];
			i--;
		}
	}
	if (cur != 1)v.push_back(cur);
	set<vector<ll>> dp;
	set<vector<ll>> dp0;
	vector<ll> vv;
	dp0.insert(vv);
	trav(fac, v) {
		trav(a, dp0) {
			vector<ll> ny;
			rep(i, 0, a.size()) {
				ny = a;
				ny[i] *= fac;
				sort(all(ny));
				dp.insert(ny);
			}
			ny = a;
			ny.push_back(fac);
			sort(all(ny));
			dp.insert(ny);
		}
		dp0 = dp;
		dp.clear();
	}
	set<ll> ans;
	trav(vec, dp0) {
		ll val = 0;
		trav(a, vec) {
			val += a - 1;
		}
		ans.insert(val);
	}
	cout << ans.size() << endl;
	trav(a, ans)cout << a << " ";
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 9 ms 888 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 9 ms 972 KB Output is correct
5 Correct 9 ms 972 KB Output is correct
6 Correct 9 ms 1000 KB Output is correct
7 Correct 9 ms 980 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 10 ms 972 KB Output is correct
11 Correct 10 ms 984 KB Output is correct
12 Correct 10 ms 1008 KB Output is correct
13 Correct 10 ms 1000 KB Output is correct
14 Correct 11 ms 912 KB Output is correct
15 Correct 9 ms 968 KB Output is correct
16 Correct 9 ms 1000 KB Output is correct
17 Correct 9 ms 972 KB Output is correct
18 Correct 9 ms 992 KB Output is correct
19 Correct 9 ms 972 KB Output is correct
20 Correct 10 ms 972 KB Output is correct
21 Correct 9 ms 956 KB Output is correct
22 Correct 10 ms 960 KB Output is correct
23 Correct 9 ms 952 KB Output is correct
24 Correct 9 ms 972 KB Output is correct
25 Correct 9 ms 972 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 9 ms 888 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 9 ms 972 KB Output is correct
5 Correct 9 ms 972 KB Output is correct
6 Correct 9 ms 1000 KB Output is correct
7 Correct 9 ms 980 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 10 ms 972 KB Output is correct
11 Correct 10 ms 984 KB Output is correct
12 Correct 10 ms 1008 KB Output is correct
13 Correct 10 ms 1000 KB Output is correct
14 Correct 11 ms 912 KB Output is correct
15 Correct 9 ms 968 KB Output is correct
16 Correct 9 ms 1000 KB Output is correct
17 Correct 9 ms 972 KB Output is correct
18 Correct 9 ms 992 KB Output is correct
19 Correct 9 ms 972 KB Output is correct
20 Correct 10 ms 972 KB Output is correct
21 Correct 9 ms 956 KB Output is correct
22 Correct 10 ms 960 KB Output is correct
23 Correct 9 ms 952 KB Output is correct
24 Correct 9 ms 972 KB Output is correct
25 Correct 9 ms 972 KB Output is correct
26 Correct 11 ms 1004 KB Output is correct
27 Correct 10 ms 1004 KB Output is correct
28 Correct 10 ms 972 KB Output is correct
29 Correct 11 ms 972 KB Output is correct
30 Correct 10 ms 1020 KB Output is correct
31 Correct 10 ms 1084 KB Output is correct
32 Correct 10 ms 1004 KB Output is correct
33 Correct 9 ms 972 KB Output is correct
34 Correct 10 ms 972 KB Output is correct
35 Correct 9 ms 884 KB Output is correct
36 Correct 10 ms 912 KB Output is correct
37 Correct 11 ms 1016 KB Output is correct
38 Correct 10 ms 1012 KB Output is correct
39 Correct 11 ms 1008 KB Output is correct
40 Correct 10 ms 972 KB Output is correct
41 Correct 9 ms 900 KB Output is correct
42 Correct 9 ms 908 KB Output is correct
43 Correct 10 ms 992 KB Output is correct
44 Correct 10 ms 1100 KB Output is correct
45 Correct 9 ms 1008 KB Output is correct
46 Correct 9 ms 972 KB Output is correct
47 Correct 9 ms 992 KB Output is correct
48 Correct 9 ms 896 KB Output is correct
49 Correct 10 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 9 ms 888 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 9 ms 972 KB Output is correct
5 Correct 9 ms 972 KB Output is correct
6 Correct 9 ms 1000 KB Output is correct
7 Correct 9 ms 980 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 10 ms 972 KB Output is correct
11 Correct 10 ms 984 KB Output is correct
12 Correct 10 ms 1008 KB Output is correct
13 Correct 10 ms 1000 KB Output is correct
14 Correct 11 ms 912 KB Output is correct
15 Correct 9 ms 968 KB Output is correct
16 Correct 9 ms 1000 KB Output is correct
17 Correct 9 ms 972 KB Output is correct
18 Correct 9 ms 992 KB Output is correct
19 Correct 9 ms 972 KB Output is correct
20 Correct 10 ms 972 KB Output is correct
21 Correct 9 ms 956 KB Output is correct
22 Correct 10 ms 960 KB Output is correct
23 Correct 9 ms 952 KB Output is correct
24 Correct 9 ms 972 KB Output is correct
25 Correct 9 ms 972 KB Output is correct
26 Correct 11 ms 1004 KB Output is correct
27 Correct 10 ms 1004 KB Output is correct
28 Correct 10 ms 972 KB Output is correct
29 Correct 11 ms 972 KB Output is correct
30 Correct 10 ms 1020 KB Output is correct
31 Correct 10 ms 1084 KB Output is correct
32 Correct 10 ms 1004 KB Output is correct
33 Correct 9 ms 972 KB Output is correct
34 Correct 10 ms 972 KB Output is correct
35 Correct 9 ms 884 KB Output is correct
36 Correct 10 ms 912 KB Output is correct
37 Correct 11 ms 1016 KB Output is correct
38 Correct 10 ms 1012 KB Output is correct
39 Correct 11 ms 1008 KB Output is correct
40 Correct 10 ms 972 KB Output is correct
41 Correct 9 ms 900 KB Output is correct
42 Correct 9 ms 908 KB Output is correct
43 Correct 10 ms 992 KB Output is correct
44 Correct 10 ms 1100 KB Output is correct
45 Correct 9 ms 1008 KB Output is correct
46 Correct 9 ms 972 KB Output is correct
47 Correct 9 ms 992 KB Output is correct
48 Correct 9 ms 896 KB Output is correct
49 Correct 10 ms 1100 KB Output is correct
50 Correct 11 ms 1324 KB Output is correct
51 Correct 11 ms 1356 KB Output is correct
52 Correct 11 ms 1400 KB Output is correct
53 Correct 11 ms 1348 KB Output is correct
54 Correct 10 ms 1100 KB Output is correct
55 Correct 13 ms 1772 KB Output is correct
56 Correct 13 ms 1768 KB Output is correct
57 Correct 14 ms 1612 KB Output is correct
58 Correct 10 ms 1000 KB Output is correct
59 Correct 9 ms 972 KB Output is correct
60 Correct 12 ms 1000 KB Output is correct
61 Correct 13 ms 1368 KB Output is correct
62 Correct 11 ms 1100 KB Output is correct
63 Correct 10 ms 972 KB Output is correct
64 Correct 10 ms 972 KB Output is correct
65 Correct 11 ms 1260 KB Output is correct
66 Correct 9 ms 968 KB Output is correct
67 Correct 9 ms 972 KB Output is correct
68 Correct 10 ms 988 KB Output is correct
69 Correct 10 ms 972 KB Output is correct
70 Correct 11 ms 1104 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 9 ms 888 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 9 ms 972 KB Output is correct
5 Correct 9 ms 972 KB Output is correct
6 Correct 9 ms 1000 KB Output is correct
7 Correct 9 ms 980 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 10 ms 972 KB Output is correct
11 Correct 10 ms 984 KB Output is correct
12 Correct 10 ms 1008 KB Output is correct
13 Correct 10 ms 1000 KB Output is correct
14 Correct 11 ms 912 KB Output is correct
15 Correct 9 ms 968 KB Output is correct
16 Correct 9 ms 1000 KB Output is correct
17 Correct 9 ms 972 KB Output is correct
18 Correct 9 ms 992 KB Output is correct
19 Correct 9 ms 972 KB Output is correct
20 Correct 10 ms 972 KB Output is correct
21 Correct 9 ms 956 KB Output is correct
22 Correct 10 ms 960 KB Output is correct
23 Correct 9 ms 952 KB Output is correct
24 Correct 9 ms 972 KB Output is correct
25 Correct 9 ms 972 KB Output is correct
26 Correct 11 ms 1004 KB Output is correct
27 Correct 10 ms 1004 KB Output is correct
28 Correct 10 ms 972 KB Output is correct
29 Correct 11 ms 972 KB Output is correct
30 Correct 10 ms 1020 KB Output is correct
31 Correct 10 ms 1084 KB Output is correct
32 Correct 10 ms 1004 KB Output is correct
33 Correct 9 ms 972 KB Output is correct
34 Correct 10 ms 972 KB Output is correct
35 Correct 9 ms 884 KB Output is correct
36 Correct 10 ms 912 KB Output is correct
37 Correct 11 ms 1016 KB Output is correct
38 Correct 10 ms 1012 KB Output is correct
39 Correct 11 ms 1008 KB Output is correct
40 Correct 10 ms 972 KB Output is correct
41 Correct 9 ms 900 KB Output is correct
42 Correct 9 ms 908 KB Output is correct
43 Correct 10 ms 992 KB Output is correct
44 Correct 10 ms 1100 KB Output is correct
45 Correct 9 ms 1008 KB Output is correct
46 Correct 9 ms 972 KB Output is correct
47 Correct 9 ms 992 KB Output is correct
48 Correct 9 ms 896 KB Output is correct
49 Correct 10 ms 1100 KB Output is correct
50 Correct 11 ms 1324 KB Output is correct
51 Correct 11 ms 1356 KB Output is correct
52 Correct 11 ms 1400 KB Output is correct
53 Correct 11 ms 1348 KB Output is correct
54 Correct 10 ms 1100 KB Output is correct
55 Correct 13 ms 1772 KB Output is correct
56 Correct 13 ms 1768 KB Output is correct
57 Correct 14 ms 1612 KB Output is correct
58 Correct 10 ms 1000 KB Output is correct
59 Correct 9 ms 972 KB Output is correct
60 Correct 12 ms 1000 KB Output is correct
61 Correct 13 ms 1368 KB Output is correct
62 Correct 11 ms 1100 KB Output is correct
63 Correct 10 ms 972 KB Output is correct
64 Correct 10 ms 972 KB Output is correct
65 Correct 11 ms 1260 KB Output is correct
66 Correct 9 ms 968 KB Output is correct
67 Correct 9 ms 972 KB Output is correct
68 Correct 10 ms 988 KB Output is correct
69 Correct 10 ms 972 KB Output is correct
70 Correct 11 ms 1104 KB Output is correct
71 Correct 366 ms 65420 KB Output is correct
72 Correct 193 ms 39744 KB Output is correct
73 Correct 405 ms 79728 KB Output is correct
74 Correct 146 ms 30812 KB Output is correct
75 Correct 212 ms 44940 KB Output is correct
76 Correct 732 ms 151160 KB Output is correct
77 Correct 1068 ms 188568 KB Output is correct
78 Correct 539 ms 115264 KB Output is correct
79 Correct 608 ms 122816 KB Output is correct
80 Correct 9 ms 972 KB Output is correct
81 Correct 9 ms 932 KB Output is correct
82 Correct 32 ms 1704 KB Output is correct
83 Correct 300 ms 17068 KB Output is correct
84 Correct 145 ms 15680 KB Output is correct
85 Correct 34 ms 3144 KB Output is correct
86 Correct 9 ms 972 KB Output is correct
87 Correct 164 ms 14600 KB Output is correct
88 Correct 9 ms 972 KB Output is correct
89 Correct 10 ms 972 KB Output is correct
90 Correct 10 ms 1008 KB Output is correct
91 Correct 24 ms 2892 KB Output is correct
92 Correct 54 ms 10692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 972 KB Output is correct
2 Correct 9 ms 888 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 9 ms 972 KB Output is correct
5 Correct 9 ms 972 KB Output is correct
6 Correct 9 ms 1000 KB Output is correct
7 Correct 9 ms 980 KB Output is correct
8 Correct 10 ms 972 KB Output is correct
9 Correct 10 ms 972 KB Output is correct
10 Correct 10 ms 972 KB Output is correct
11 Correct 10 ms 984 KB Output is correct
12 Correct 10 ms 1008 KB Output is correct
13 Correct 10 ms 1000 KB Output is correct
14 Correct 11 ms 912 KB Output is correct
15 Correct 9 ms 968 KB Output is correct
16 Correct 9 ms 1000 KB Output is correct
17 Correct 9 ms 972 KB Output is correct
18 Correct 9 ms 992 KB Output is correct
19 Correct 9 ms 972 KB Output is correct
20 Correct 10 ms 972 KB Output is correct
21 Correct 9 ms 956 KB Output is correct
22 Correct 10 ms 960 KB Output is correct
23 Correct 9 ms 952 KB Output is correct
24 Correct 9 ms 972 KB Output is correct
25 Correct 9 ms 972 KB Output is correct
26 Correct 11 ms 1004 KB Output is correct
27 Correct 10 ms 1004 KB Output is correct
28 Correct 10 ms 972 KB Output is correct
29 Correct 11 ms 972 KB Output is correct
30 Correct 10 ms 1020 KB Output is correct
31 Correct 10 ms 1084 KB Output is correct
32 Correct 10 ms 1004 KB Output is correct
33 Correct 9 ms 972 KB Output is correct
34 Correct 10 ms 972 KB Output is correct
35 Correct 9 ms 884 KB Output is correct
36 Correct 10 ms 912 KB Output is correct
37 Correct 11 ms 1016 KB Output is correct
38 Correct 10 ms 1012 KB Output is correct
39 Correct 11 ms 1008 KB Output is correct
40 Correct 10 ms 972 KB Output is correct
41 Correct 9 ms 900 KB Output is correct
42 Correct 9 ms 908 KB Output is correct
43 Correct 10 ms 992 KB Output is correct
44 Correct 10 ms 1100 KB Output is correct
45 Correct 9 ms 1008 KB Output is correct
46 Correct 9 ms 972 KB Output is correct
47 Correct 9 ms 992 KB Output is correct
48 Correct 9 ms 896 KB Output is correct
49 Correct 10 ms 1100 KB Output is correct
50 Correct 11 ms 1324 KB Output is correct
51 Correct 11 ms 1356 KB Output is correct
52 Correct 11 ms 1400 KB Output is correct
53 Correct 11 ms 1348 KB Output is correct
54 Correct 10 ms 1100 KB Output is correct
55 Correct 13 ms 1772 KB Output is correct
56 Correct 13 ms 1768 KB Output is correct
57 Correct 14 ms 1612 KB Output is correct
58 Correct 10 ms 1000 KB Output is correct
59 Correct 9 ms 972 KB Output is correct
60 Correct 12 ms 1000 KB Output is correct
61 Correct 13 ms 1368 KB Output is correct
62 Correct 11 ms 1100 KB Output is correct
63 Correct 10 ms 972 KB Output is correct
64 Correct 10 ms 972 KB Output is correct
65 Correct 11 ms 1260 KB Output is correct
66 Correct 9 ms 968 KB Output is correct
67 Correct 9 ms 972 KB Output is correct
68 Correct 10 ms 988 KB Output is correct
69 Correct 10 ms 972 KB Output is correct
70 Correct 11 ms 1104 KB Output is correct
71 Correct 366 ms 65420 KB Output is correct
72 Correct 193 ms 39744 KB Output is correct
73 Correct 405 ms 79728 KB Output is correct
74 Correct 146 ms 30812 KB Output is correct
75 Correct 212 ms 44940 KB Output is correct
76 Correct 732 ms 151160 KB Output is correct
77 Correct 1068 ms 188568 KB Output is correct
78 Correct 539 ms 115264 KB Output is correct
79 Correct 608 ms 122816 KB Output is correct
80 Correct 9 ms 972 KB Output is correct
81 Correct 9 ms 932 KB Output is correct
82 Correct 32 ms 1704 KB Output is correct
83 Correct 300 ms 17068 KB Output is correct
84 Correct 145 ms 15680 KB Output is correct
85 Correct 34 ms 3144 KB Output is correct
86 Correct 9 ms 972 KB Output is correct
87 Correct 164 ms 14600 KB Output is correct
88 Correct 9 ms 972 KB Output is correct
89 Correct 10 ms 972 KB Output is correct
90 Correct 10 ms 1008 KB Output is correct
91 Correct 24 ms 2892 KB Output is correct
92 Correct 54 ms 10692 KB Output is correct
93 Runtime error 1371 ms 262148 KB Execution killed with signal 9
94 Halted 0 ms 0 KB -