# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
112427 | 2019-05-19T16:49:15 Z | Magisko | Toys (CEOI18_toy) | C++14 | 5000 ms | 82200 KB |
#include <bits/stdc++.h> using namespace std ; vector<int> primes ; bool isprime[105000] ; int maxi(int n) { int counter = 0 ; int m = n ; for (int i(0) ; i<primes.size() ; i++) { while(n%primes[i]==0) { n /= primes[i] ; counter++ ; } } if (n==m) return 2 ; return counter ; } vector<vector<int>> f(int n, int k) { if (k==0) return {} ; if (k==1) return {{n}} ; if (n==1) return {{1}} ; vector<vector<int>> sol ; vector<int> par ; par.clear() ; sol.clear() ; for (int i(2) ; i<n ; i++) { if (n%i==0) { vector<vector<int>> pre = f(n/i , k-1) ; for (int j(0) ; j<pre.size() ; j++) { par.push_back(i) ; for (int u(0) ; u<pre[j].size() ; u++) { par.push_back(pre[j][u]) ; } sol.push_back(par) ; par.clear() ; } } } if (sol.empty()) return {{n}}; return sol ; } int main() { for (int i(0) ; i<105000 ; i++) { isprime[i] = 1 ; } for (int i(2) ; i<105000 ; i++) { if (isprime[i]) { for (int j(2); i*j<105000 ; j++) { isprime[i*j] = 0 ; } } } for (int i(2) ; i<105000 ; i++) if (isprime[i]) primes.push_back(i) ; int n ; cin >> n ; int top = maxi(n) ; vector<int> sums ; vector<bool> used(n,false) ; for (int k(1) ; k<=top ; k++) { vector<vector<int>> p = f(n,k) ; for (int i(0) ; i<p.size() ; i++) { int sum = 0 ; for (int j(0) ; j<p[i].size() ; j++) { sum += p[i][j]-1 ; } if (!used[sum]) { sums.push_back(sum) ; used[sum] = 1 ; } } } sort(sums.begin(),sums.end()) ; cout << sums.size() << '\n' ; for (int i(0) ; i<sums.size() ; i++) cout << sums[i] << ' ' ; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 3 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 512 KB | Output is correct |
22 | Correct | 3 ms | 512 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 3 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 512 KB | Output is correct |
22 | Correct | 3 ms | 512 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 38 ms | 1564 KB | Output is correct |
27 | Correct | 30 ms | 1532 KB | Output is correct |
28 | Correct | 9 ms | 744 KB | Output is correct |
29 | Correct | 7 ms | 640 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 162 ms | 4680 KB | Output is correct |
32 | Correct | 61 ms | 2308 KB | Output is correct |
33 | Correct | 51 ms | 2156 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 3 ms | 512 KB | Output is correct |
36 | Correct | 15 ms | 640 KB | Output is correct |
37 | Correct | 57 ms | 1796 KB | Output is correct |
38 | Correct | 7 ms | 640 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 24 ms | 1340 KB | Output is correct |
41 | Correct | 3 ms | 512 KB | Output is correct |
42 | Correct | 3 ms | 512 KB | Output is correct |
43 | Correct | 4 ms | 512 KB | Output is correct |
44 | Correct | 3 ms | 512 KB | Output is correct |
45 | Correct | 5 ms | 512 KB | Output is correct |
46 | Correct | 3 ms | 512 KB | Output is correct |
47 | Correct | 35 ms | 1404 KB | Output is correct |
48 | Correct | 3 ms | 512 KB | Output is correct |
49 | Correct | 5 ms | 512 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 3 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 512 KB | Output is correct |
22 | Correct | 3 ms | 512 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 38 ms | 1564 KB | Output is correct |
27 | Correct | 30 ms | 1532 KB | Output is correct |
28 | Correct | 9 ms | 744 KB | Output is correct |
29 | Correct | 7 ms | 640 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 162 ms | 4680 KB | Output is correct |
32 | Correct | 61 ms | 2308 KB | Output is correct |
33 | Correct | 51 ms | 2156 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 3 ms | 512 KB | Output is correct |
36 | Correct | 15 ms | 640 KB | Output is correct |
37 | Correct | 57 ms | 1796 KB | Output is correct |
38 | Correct | 7 ms | 640 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 24 ms | 1340 KB | Output is correct |
41 | Correct | 3 ms | 512 KB | Output is correct |
42 | Correct | 3 ms | 512 KB | Output is correct |
43 | Correct | 4 ms | 512 KB | Output is correct |
44 | Correct | 3 ms | 512 KB | Output is correct |
45 | Correct | 5 ms | 512 KB | Output is correct |
46 | Correct | 3 ms | 512 KB | Output is correct |
47 | Correct | 35 ms | 1404 KB | Output is correct |
48 | Correct | 3 ms | 512 KB | Output is correct |
49 | Correct | 5 ms | 512 KB | Output is correct |
50 | Correct | 575 ms | 16724 KB | Output is correct |
51 | Correct | 459 ms | 14208 KB | Output is correct |
52 | Correct | 979 ms | 28548 KB | Output is correct |
53 | Correct | 784 ms | 19256 KB | Output is correct |
54 | Correct | 103 ms | 3968 KB | Output is correct |
55 | Correct | 3769 ms | 75596 KB | Output is correct |
56 | Correct | 4591 ms | 82200 KB | Output is correct |
57 | Correct | 1398 ms | 35700 KB | Output is correct |
58 | Correct | 3 ms | 512 KB | Output is correct |
59 | Correct | 3 ms | 512 KB | Output is correct |
60 | Correct | 143 ms | 2072 KB | Output is correct |
61 | Correct | 2813 ms | 59452 KB | Output is correct |
62 | Correct | 117 ms | 4160 KB | Output is correct |
63 | Correct | 72 ms | 1748 KB | Output is correct |
64 | Correct | 4 ms | 512 KB | Output is correct |
65 | Correct | 446 ms | 13356 KB | Output is correct |
66 | Correct | 3 ms | 512 KB | Output is correct |
67 | Correct | 3 ms | 512 KB | Output is correct |
68 | Correct | 7 ms | 512 KB | Output is correct |
69 | Correct | 11 ms | 640 KB | Output is correct |
70 | Correct | 43 ms | 1992 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 3 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 512 KB | Output is correct |
22 | Correct | 3 ms | 512 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 38 ms | 1564 KB | Output is correct |
27 | Correct | 30 ms | 1532 KB | Output is correct |
28 | Correct | 9 ms | 744 KB | Output is correct |
29 | Correct | 7 ms | 640 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 162 ms | 4680 KB | Output is correct |
32 | Correct | 61 ms | 2308 KB | Output is correct |
33 | Correct | 51 ms | 2156 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 3 ms | 512 KB | Output is correct |
36 | Correct | 15 ms | 640 KB | Output is correct |
37 | Correct | 57 ms | 1796 KB | Output is correct |
38 | Correct | 7 ms | 640 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 24 ms | 1340 KB | Output is correct |
41 | Correct | 3 ms | 512 KB | Output is correct |
42 | Correct | 3 ms | 512 KB | Output is correct |
43 | Correct | 4 ms | 512 KB | Output is correct |
44 | Correct | 3 ms | 512 KB | Output is correct |
45 | Correct | 5 ms | 512 KB | Output is correct |
46 | Correct | 3 ms | 512 KB | Output is correct |
47 | Correct | 35 ms | 1404 KB | Output is correct |
48 | Correct | 3 ms | 512 KB | Output is correct |
49 | Correct | 5 ms | 512 KB | Output is correct |
50 | Correct | 575 ms | 16724 KB | Output is correct |
51 | Correct | 459 ms | 14208 KB | Output is correct |
52 | Correct | 979 ms | 28548 KB | Output is correct |
53 | Correct | 784 ms | 19256 KB | Output is correct |
54 | Correct | 103 ms | 3968 KB | Output is correct |
55 | Correct | 3769 ms | 75596 KB | Output is correct |
56 | Correct | 4591 ms | 82200 KB | Output is correct |
57 | Correct | 1398 ms | 35700 KB | Output is correct |
58 | Correct | 3 ms | 512 KB | Output is correct |
59 | Correct | 3 ms | 512 KB | Output is correct |
60 | Correct | 143 ms | 2072 KB | Output is correct |
61 | Correct | 2813 ms | 59452 KB | Output is correct |
62 | Correct | 117 ms | 4160 KB | Output is correct |
63 | Correct | 72 ms | 1748 KB | Output is correct |
64 | Correct | 4 ms | 512 KB | Output is correct |
65 | Correct | 446 ms | 13356 KB | Output is correct |
66 | Correct | 3 ms | 512 KB | Output is correct |
67 | Correct | 3 ms | 512 KB | Output is correct |
68 | Correct | 7 ms | 512 KB | Output is correct |
69 | Correct | 11 ms | 640 KB | Output is correct |
70 | Correct | 43 ms | 1992 KB | Output is correct |
71 | Execution timed out | 5070 ms | 51200 KB | Time limit exceeded |
72 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 512 KB | Output is correct |
2 | Correct | 3 ms | 512 KB | Output is correct |
3 | Correct | 3 ms | 512 KB | Output is correct |
4 | Correct | 3 ms | 512 KB | Output is correct |
5 | Correct | 3 ms | 512 KB | Output is correct |
6 | Correct | 3 ms | 512 KB | Output is correct |
7 | Correct | 3 ms | 512 KB | Output is correct |
8 | Correct | 3 ms | 512 KB | Output is correct |
9 | Correct | 3 ms | 512 KB | Output is correct |
10 | Correct | 3 ms | 512 KB | Output is correct |
11 | Correct | 3 ms | 512 KB | Output is correct |
12 | Correct | 3 ms | 512 KB | Output is correct |
13 | Correct | 3 ms | 512 KB | Output is correct |
14 | Correct | 3 ms | 512 KB | Output is correct |
15 | Correct | 3 ms | 512 KB | Output is correct |
16 | Correct | 3 ms | 512 KB | Output is correct |
17 | Correct | 3 ms | 512 KB | Output is correct |
18 | Correct | 3 ms | 512 KB | Output is correct |
19 | Correct | 3 ms | 512 KB | Output is correct |
20 | Correct | 3 ms | 512 KB | Output is correct |
21 | Correct | 3 ms | 512 KB | Output is correct |
22 | Correct | 3 ms | 512 KB | Output is correct |
23 | Correct | 3 ms | 512 KB | Output is correct |
24 | Correct | 3 ms | 512 KB | Output is correct |
25 | Correct | 3 ms | 512 KB | Output is correct |
26 | Correct | 38 ms | 1564 KB | Output is correct |
27 | Correct | 30 ms | 1532 KB | Output is correct |
28 | Correct | 9 ms | 744 KB | Output is correct |
29 | Correct | 7 ms | 640 KB | Output is correct |
30 | Correct | 4 ms | 512 KB | Output is correct |
31 | Correct | 162 ms | 4680 KB | Output is correct |
32 | Correct | 61 ms | 2308 KB | Output is correct |
33 | Correct | 51 ms | 2156 KB | Output is correct |
34 | Correct | 3 ms | 512 KB | Output is correct |
35 | Correct | 3 ms | 512 KB | Output is correct |
36 | Correct | 15 ms | 640 KB | Output is correct |
37 | Correct | 57 ms | 1796 KB | Output is correct |
38 | Correct | 7 ms | 640 KB | Output is correct |
39 | Correct | 3 ms | 512 KB | Output is correct |
40 | Correct | 24 ms | 1340 KB | Output is correct |
41 | Correct | 3 ms | 512 KB | Output is correct |
42 | Correct | 3 ms | 512 KB | Output is correct |
43 | Correct | 4 ms | 512 KB | Output is correct |
44 | Correct | 3 ms | 512 KB | Output is correct |
45 | Correct | 5 ms | 512 KB | Output is correct |
46 | Correct | 3 ms | 512 KB | Output is correct |
47 | Correct | 35 ms | 1404 KB | Output is correct |
48 | Correct | 3 ms | 512 KB | Output is correct |
49 | Correct | 5 ms | 512 KB | Output is correct |
50 | Correct | 575 ms | 16724 KB | Output is correct |
51 | Correct | 459 ms | 14208 KB | Output is correct |
52 | Correct | 979 ms | 28548 KB | Output is correct |
53 | Correct | 784 ms | 19256 KB | Output is correct |
54 | Correct | 103 ms | 3968 KB | Output is correct |
55 | Correct | 3769 ms | 75596 KB | Output is correct |
56 | Correct | 4591 ms | 82200 KB | Output is correct |
57 | Correct | 1398 ms | 35700 KB | Output is correct |
58 | Correct | 3 ms | 512 KB | Output is correct |
59 | Correct | 3 ms | 512 KB | Output is correct |
60 | Correct | 143 ms | 2072 KB | Output is correct |
61 | Correct | 2813 ms | 59452 KB | Output is correct |
62 | Correct | 117 ms | 4160 KB | Output is correct |
63 | Correct | 72 ms | 1748 KB | Output is correct |
64 | Correct | 4 ms | 512 KB | Output is correct |
65 | Correct | 446 ms | 13356 KB | Output is correct |
66 | Correct | 3 ms | 512 KB | Output is correct |
67 | Correct | 3 ms | 512 KB | Output is correct |
68 | Correct | 7 ms | 512 KB | Output is correct |
69 | Correct | 11 ms | 640 KB | Output is correct |
70 | Correct | 43 ms | 1992 KB | Output is correct |
71 | Execution timed out | 5070 ms | 51200 KB | Time limit exceeded |
72 | Halted | 0 ms | 0 KB | - |