Submission #161940

# Submission time Handle Problem Language Result Execution time Memory
161940 2019-11-05T11:13:58 Z Akashi Toys (CEOI18_toy) C++14
100 / 100
3321 ms 87292 KB
#pragma GCC optimze("Ofast")
#include <bits/stdc++.h>
using namespace std;

int n, k = 1;
map <int, int> f;
set <int> s[10005];
void solve(int n, int K){
    s[K].insert(n - 1);
    int r = sqrt(n);
    for(int i = 2; i <= r ; ++i){
        if(n % i) continue ;
        if(f[i] == 0){
            ++k;
            f[i] = k;
            solve(i, k);
        }
        if(f[n / i] == 0){
            ++k;
            f[n / i] = k;
            solve(n / i, k);
        }
        int x1 = f[i];
        int x2 = f[n / i];
        for(auto it : s[x1])
            s[K].insert(it + n / i - 1);
        for(auto it : s[x2])
            s[K].insert(it + i - 1);
    }
}
int main()
{
//    freopen("1.in", "r", stdin);
    scanf("%d", &n);
    f[n] = 1;
    solve(n, 1);
    printf("%d\n", s[1].size());
    for(auto it : s[1])
        printf("%d ", it);
    return 0;
}

Compilation message

toy.cpp:1:0: warning: ignoring #pragma GCC optimze [-Wunknown-pragmas]
 #pragma GCC optimze("Ofast")
 
toy.cpp: In function 'int main()':
toy.cpp:37:31: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%d\n", s[1].size());
                    ~~~~~~~~~~~^
toy.cpp:34:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 14 ms 804 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 14 ms 804 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 3 ms 760 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
27 Correct 3 ms 888 KB Output is correct
28 Correct 3 ms 888 KB Output is correct
29 Correct 3 ms 888 KB Output is correct
30 Correct 2 ms 760 KB Output is correct
31 Correct 3 ms 888 KB Output is correct
32 Correct 3 ms 888 KB Output is correct
33 Correct 3 ms 888 KB Output is correct
34 Correct 2 ms 760 KB Output is correct
35 Correct 3 ms 760 KB Output is correct
36 Correct 2 ms 760 KB Output is correct
37 Correct 3 ms 888 KB Output is correct
38 Correct 3 ms 888 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 3 ms 888 KB Output is correct
41 Correct 3 ms 760 KB Output is correct
42 Correct 2 ms 760 KB Output is correct
43 Correct 3 ms 760 KB Output is correct
44 Correct 3 ms 760 KB Output is correct
45 Correct 3 ms 764 KB Output is correct
46 Correct 2 ms 760 KB Output is correct
47 Correct 3 ms 888 KB Output is correct
48 Correct 2 ms 760 KB Output is correct
49 Correct 3 ms 760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 14 ms 804 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 3 ms 760 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
27 Correct 3 ms 888 KB Output is correct
28 Correct 3 ms 888 KB Output is correct
29 Correct 3 ms 888 KB Output is correct
30 Correct 2 ms 760 KB Output is correct
31 Correct 3 ms 888 KB Output is correct
32 Correct 3 ms 888 KB Output is correct
33 Correct 3 ms 888 KB Output is correct
34 Correct 2 ms 760 KB Output is correct
35 Correct 3 ms 760 KB Output is correct
36 Correct 2 ms 760 KB Output is correct
37 Correct 3 ms 888 KB Output is correct
38 Correct 3 ms 888 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 3 ms 888 KB Output is correct
41 Correct 3 ms 760 KB Output is correct
42 Correct 2 ms 760 KB Output is correct
43 Correct 3 ms 760 KB Output is correct
44 Correct 3 ms 760 KB Output is correct
45 Correct 3 ms 764 KB Output is correct
46 Correct 2 ms 760 KB Output is correct
47 Correct 3 ms 888 KB Output is correct
48 Correct 2 ms 760 KB Output is correct
49 Correct 3 ms 760 KB Output is correct
50 Correct 13 ms 1144 KB Output is correct
51 Correct 5 ms 1016 KB Output is correct
52 Correct 6 ms 1016 KB Output is correct
53 Correct 5 ms 1016 KB Output is correct
54 Correct 4 ms 888 KB Output is correct
55 Correct 7 ms 1144 KB Output is correct
56 Correct 7 ms 1144 KB Output is correct
57 Correct 7 ms 1144 KB Output is correct
58 Correct 2 ms 760 KB Output is correct
59 Correct 2 ms 760 KB Output is correct
60 Correct 3 ms 888 KB Output is correct
61 Correct 4 ms 1016 KB Output is correct
62 Correct 3 ms 888 KB Output is correct
63 Correct 3 ms 888 KB Output is correct
64 Correct 2 ms 764 KB Output is correct
65 Correct 4 ms 1016 KB Output is correct
66 Correct 3 ms 760 KB Output is correct
67 Correct 2 ms 760 KB Output is correct
68 Correct 2 ms 760 KB Output is correct
69 Correct 3 ms 760 KB Output is correct
70 Correct 3 ms 888 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 14 ms 804 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 3 ms 760 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
27 Correct 3 ms 888 KB Output is correct
28 Correct 3 ms 888 KB Output is correct
29 Correct 3 ms 888 KB Output is correct
30 Correct 2 ms 760 KB Output is correct
31 Correct 3 ms 888 KB Output is correct
32 Correct 3 ms 888 KB Output is correct
33 Correct 3 ms 888 KB Output is correct
34 Correct 2 ms 760 KB Output is correct
35 Correct 3 ms 760 KB Output is correct
36 Correct 2 ms 760 KB Output is correct
37 Correct 3 ms 888 KB Output is correct
38 Correct 3 ms 888 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 3 ms 888 KB Output is correct
41 Correct 3 ms 760 KB Output is correct
42 Correct 2 ms 760 KB Output is correct
43 Correct 3 ms 760 KB Output is correct
44 Correct 3 ms 760 KB Output is correct
45 Correct 3 ms 764 KB Output is correct
46 Correct 2 ms 760 KB Output is correct
47 Correct 3 ms 888 KB Output is correct
48 Correct 2 ms 760 KB Output is correct
49 Correct 3 ms 760 KB Output is correct
50 Correct 13 ms 1144 KB Output is correct
51 Correct 5 ms 1016 KB Output is correct
52 Correct 6 ms 1016 KB Output is correct
53 Correct 5 ms 1016 KB Output is correct
54 Correct 4 ms 888 KB Output is correct
55 Correct 7 ms 1144 KB Output is correct
56 Correct 7 ms 1144 KB Output is correct
57 Correct 7 ms 1144 KB Output is correct
58 Correct 2 ms 760 KB Output is correct
59 Correct 2 ms 760 KB Output is correct
60 Correct 3 ms 888 KB Output is correct
61 Correct 4 ms 1016 KB Output is correct
62 Correct 3 ms 888 KB Output is correct
63 Correct 3 ms 888 KB Output is correct
64 Correct 2 ms 764 KB Output is correct
65 Correct 4 ms 1016 KB Output is correct
66 Correct 3 ms 760 KB Output is correct
67 Correct 2 ms 760 KB Output is correct
68 Correct 2 ms 760 KB Output is correct
69 Correct 3 ms 760 KB Output is correct
70 Correct 3 ms 888 KB Output is correct
71 Correct 464 ms 19068 KB Output is correct
72 Correct 316 ms 14484 KB Output is correct
73 Correct 448 ms 17016 KB Output is correct
74 Correct 237 ms 11512 KB Output is correct
75 Correct 273 ms 12408 KB Output is correct
76 Correct 722 ms 25284 KB Output is correct
77 Correct 646 ms 22572 KB Output is correct
78 Correct 567 ms 21232 KB Output is correct
79 Correct 562 ms 20472 KB Output is correct
80 Correct 2 ms 760 KB Output is correct
81 Correct 3 ms 760 KB Output is correct
82 Correct 6 ms 1144 KB Output is correct
83 Correct 61 ms 4216 KB Output is correct
84 Correct 78 ms 4856 KB Output is correct
85 Correct 19 ms 2040 KB Output is correct
86 Correct 3 ms 836 KB Output is correct
87 Correct 92 ms 5496 KB Output is correct
88 Correct 3 ms 760 KB Output is correct
89 Correct 2 ms 760 KB Output is correct
90 Correct 3 ms 892 KB Output is correct
91 Correct 25 ms 2680 KB Output is correct
92 Correct 111 ms 7056 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 760 KB Output is correct
2 Correct 14 ms 804 KB Output is correct
3 Correct 2 ms 760 KB Output is correct
4 Correct 2 ms 760 KB Output is correct
5 Correct 2 ms 760 KB Output is correct
6 Correct 2 ms 760 KB Output is correct
7 Correct 2 ms 760 KB Output is correct
8 Correct 2 ms 764 KB Output is correct
9 Correct 2 ms 760 KB Output is correct
10 Correct 2 ms 760 KB Output is correct
11 Correct 2 ms 760 KB Output is correct
12 Correct 2 ms 760 KB Output is correct
13 Correct 2 ms 760 KB Output is correct
14 Correct 3 ms 760 KB Output is correct
15 Correct 2 ms 760 KB Output is correct
16 Correct 3 ms 760 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 760 KB Output is correct
19 Correct 3 ms 760 KB Output is correct
20 Correct 2 ms 760 KB Output is correct
21 Correct 2 ms 760 KB Output is correct
22 Correct 2 ms 760 KB Output is correct
23 Correct 2 ms 760 KB Output is correct
24 Correct 3 ms 760 KB Output is correct
25 Correct 3 ms 760 KB Output is correct
26 Correct 3 ms 888 KB Output is correct
27 Correct 3 ms 888 KB Output is correct
28 Correct 3 ms 888 KB Output is correct
29 Correct 3 ms 888 KB Output is correct
30 Correct 2 ms 760 KB Output is correct
31 Correct 3 ms 888 KB Output is correct
32 Correct 3 ms 888 KB Output is correct
33 Correct 3 ms 888 KB Output is correct
34 Correct 2 ms 760 KB Output is correct
35 Correct 3 ms 760 KB Output is correct
36 Correct 2 ms 760 KB Output is correct
37 Correct 3 ms 888 KB Output is correct
38 Correct 3 ms 888 KB Output is correct
39 Correct 3 ms 760 KB Output is correct
40 Correct 3 ms 888 KB Output is correct
41 Correct 3 ms 760 KB Output is correct
42 Correct 2 ms 760 KB Output is correct
43 Correct 3 ms 760 KB Output is correct
44 Correct 3 ms 760 KB Output is correct
45 Correct 3 ms 764 KB Output is correct
46 Correct 2 ms 760 KB Output is correct
47 Correct 3 ms 888 KB Output is correct
48 Correct 2 ms 760 KB Output is correct
49 Correct 3 ms 760 KB Output is correct
50 Correct 13 ms 1144 KB Output is correct
51 Correct 5 ms 1016 KB Output is correct
52 Correct 6 ms 1016 KB Output is correct
53 Correct 5 ms 1016 KB Output is correct
54 Correct 4 ms 888 KB Output is correct
55 Correct 7 ms 1144 KB Output is correct
56 Correct 7 ms 1144 KB Output is correct
57 Correct 7 ms 1144 KB Output is correct
58 Correct 2 ms 760 KB Output is correct
59 Correct 2 ms 760 KB Output is correct
60 Correct 3 ms 888 KB Output is correct
61 Correct 4 ms 1016 KB Output is correct
62 Correct 3 ms 888 KB Output is correct
63 Correct 3 ms 888 KB Output is correct
64 Correct 2 ms 764 KB Output is correct
65 Correct 4 ms 1016 KB Output is correct
66 Correct 3 ms 760 KB Output is correct
67 Correct 2 ms 760 KB Output is correct
68 Correct 2 ms 760 KB Output is correct
69 Correct 3 ms 760 KB Output is correct
70 Correct 3 ms 888 KB Output is correct
71 Correct 464 ms 19068 KB Output is correct
72 Correct 316 ms 14484 KB Output is correct
73 Correct 448 ms 17016 KB Output is correct
74 Correct 237 ms 11512 KB Output is correct
75 Correct 273 ms 12408 KB Output is correct
76 Correct 722 ms 25284 KB Output is correct
77 Correct 646 ms 22572 KB Output is correct
78 Correct 567 ms 21232 KB Output is correct
79 Correct 562 ms 20472 KB Output is correct
80 Correct 2 ms 760 KB Output is correct
81 Correct 3 ms 760 KB Output is correct
82 Correct 6 ms 1144 KB Output is correct
83 Correct 61 ms 4216 KB Output is correct
84 Correct 78 ms 4856 KB Output is correct
85 Correct 19 ms 2040 KB Output is correct
86 Correct 3 ms 836 KB Output is correct
87 Correct 92 ms 5496 KB Output is correct
88 Correct 3 ms 760 KB Output is correct
89 Correct 2 ms 760 KB Output is correct
90 Correct 3 ms 892 KB Output is correct
91 Correct 25 ms 2680 KB Output is correct
92 Correct 111 ms 7056 KB Output is correct
93 Correct 2727 ms 77868 KB Output is correct
94 Correct 1514 ms 52728 KB Output is correct
95 Correct 1717 ms 55372 KB Output is correct
96 Correct 1514 ms 49272 KB Output is correct
97 Correct 1419 ms 45048 KB Output is correct
98 Correct 3132 ms 85892 KB Output is correct
99 Correct 3321 ms 87292 KB Output is correct
100 Correct 3007 ms 83708 KB Output is correct
101 Correct 2861 ms 77688 KB Output is correct
102 Correct 2653 ms 70176 KB Output is correct
103 Correct 2001 ms 62808 KB Output is correct
104 Correct 3 ms 760 KB Output is correct
105 Correct 3 ms 760 KB Output is correct
106 Correct 9 ms 1400 KB Output is correct
107 Correct 201 ms 10104 KB Output is correct
108 Correct 520 ms 20856 KB Output is correct
109 Correct 46 ms 3704 KB Output is correct
110 Correct 3 ms 760 KB Output is correct
111 Correct 270 ms 12664 KB Output is correct
112 Correct 3 ms 760 KB Output is correct
113 Correct 3 ms 760 KB Output is correct
114 Correct 10 ms 1400 KB Output is correct
115 Correct 3 ms 760 KB Output is correct
116 Correct 45 ms 2168 KB Output is correct
117 Correct 537 ms 25180 KB Output is correct