Submission #147151

# Submission time Handle Problem Language Result Execution time Memory
147151 2019-08-28T06:07:24 Z jh05013 Toys (CEOI18_toy) PyPy
100 / 100
1986 ms 89928 KB
range = xrange

n = int(raw_input())
div = set()
for i in range(1, 100000):
    if n%i: continue
    div|= {i, n//i}
div = sorted(div)

dp = {}
def add(n):
    if n == 1: return {0}
    if n in dp: return dp[n]
    ans = set()
    for d in div:
        if d == 1 or n%d: continue
        ans|= {d-1+x for x in add(n//d)}
    dp[n] = ans
    return ans

S = add(n)
print(len(S))
for x in sorted(S): print x,
# Verdict Execution time Memory Grader output
1 Correct 37 ms 12620 KB Output is correct
2 Correct 35 ms 10980 KB Output is correct
3 Correct 35 ms 11096 KB Output is correct
4 Correct 36 ms 11096 KB Output is correct
5 Correct 34 ms 11096 KB Output is correct
6 Correct 35 ms 11104 KB Output is correct
7 Correct 34 ms 11104 KB Output is correct
8 Correct 36 ms 11204 KB Output is correct
9 Correct 93 ms 11068 KB Output is correct
10 Correct 35 ms 11104 KB Output is correct
11 Correct 36 ms 11196 KB Output is correct
12 Correct 36 ms 11224 KB Output is correct
13 Correct 35 ms 11068 KB Output is correct
14 Correct 35 ms 11232 KB Output is correct
15 Correct 35 ms 11104 KB Output is correct
16 Correct 35 ms 11104 KB Output is correct
17 Correct 34 ms 11096 KB Output is correct
18 Correct 35 ms 11096 KB Output is correct
19 Correct 35 ms 11096 KB Output is correct
20 Correct 35 ms 11096 KB Output is correct
21 Correct 41 ms 11096 KB Output is correct
22 Correct 36 ms 11104 KB Output is correct
23 Correct 35 ms 11104 KB Output is correct
24 Correct 35 ms 11104 KB Output is correct
25 Correct 36 ms 11132 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 12620 KB Output is correct
2 Correct 35 ms 10980 KB Output is correct
3 Correct 35 ms 11096 KB Output is correct
4 Correct 36 ms 11096 KB Output is correct
5 Correct 34 ms 11096 KB Output is correct
6 Correct 35 ms 11104 KB Output is correct
7 Correct 34 ms 11104 KB Output is correct
8 Correct 36 ms 11204 KB Output is correct
9 Correct 93 ms 11068 KB Output is correct
10 Correct 35 ms 11104 KB Output is correct
11 Correct 36 ms 11196 KB Output is correct
12 Correct 36 ms 11224 KB Output is correct
13 Correct 35 ms 11068 KB Output is correct
14 Correct 35 ms 11232 KB Output is correct
15 Correct 35 ms 11104 KB Output is correct
16 Correct 35 ms 11104 KB Output is correct
17 Correct 34 ms 11096 KB Output is correct
18 Correct 35 ms 11096 KB Output is correct
19 Correct 35 ms 11096 KB Output is correct
20 Correct 35 ms 11096 KB Output is correct
21 Correct 41 ms 11096 KB Output is correct
22 Correct 36 ms 11104 KB Output is correct
23 Correct 35 ms 11104 KB Output is correct
24 Correct 35 ms 11104 KB Output is correct
25 Correct 36 ms 11132 KB Output is correct
26 Correct 50 ms 13188 KB Output is correct
27 Correct 46 ms 11740 KB Output is correct
28 Correct 40 ms 11456 KB Output is correct
29 Correct 40 ms 11460 KB Output is correct
30 Correct 37 ms 11220 KB Output is correct
31 Correct 49 ms 12340 KB Output is correct
32 Correct 50 ms 14188 KB Output is correct
33 Correct 47 ms 12108 KB Output is correct
34 Correct 35 ms 11104 KB Output is correct
35 Correct 35 ms 11104 KB Output is correct
36 Correct 36 ms 11104 KB Output is correct
37 Correct 43 ms 11476 KB Output is correct
38 Correct 36 ms 11104 KB Output is correct
39 Correct 35 ms 11100 KB Output is correct
40 Correct 44 ms 11604 KB Output is correct
41 Correct 34 ms 11104 KB Output is correct
42 Correct 34 ms 11096 KB Output is correct
43 Correct 35 ms 11096 KB Output is correct
44 Correct 34 ms 11092 KB Output is correct
45 Correct 37 ms 11224 KB Output is correct
46 Correct 35 ms 11104 KB Output is correct
47 Correct 40 ms 11348 KB Output is correct
48 Correct 35 ms 11104 KB Output is correct
49 Correct 37 ms 11088 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 12620 KB Output is correct
2 Correct 35 ms 10980 KB Output is correct
3 Correct 35 ms 11096 KB Output is correct
4 Correct 36 ms 11096 KB Output is correct
5 Correct 34 ms 11096 KB Output is correct
6 Correct 35 ms 11104 KB Output is correct
7 Correct 34 ms 11104 KB Output is correct
8 Correct 36 ms 11204 KB Output is correct
9 Correct 93 ms 11068 KB Output is correct
10 Correct 35 ms 11104 KB Output is correct
11 Correct 36 ms 11196 KB Output is correct
12 Correct 36 ms 11224 KB Output is correct
13 Correct 35 ms 11068 KB Output is correct
14 Correct 35 ms 11232 KB Output is correct
15 Correct 35 ms 11104 KB Output is correct
16 Correct 35 ms 11104 KB Output is correct
17 Correct 34 ms 11096 KB Output is correct
18 Correct 35 ms 11096 KB Output is correct
19 Correct 35 ms 11096 KB Output is correct
20 Correct 35 ms 11096 KB Output is correct
21 Correct 41 ms 11096 KB Output is correct
22 Correct 36 ms 11104 KB Output is correct
23 Correct 35 ms 11104 KB Output is correct
24 Correct 35 ms 11104 KB Output is correct
25 Correct 36 ms 11132 KB Output is correct
26 Correct 50 ms 13188 KB Output is correct
27 Correct 46 ms 11740 KB Output is correct
28 Correct 40 ms 11456 KB Output is correct
29 Correct 40 ms 11460 KB Output is correct
30 Correct 37 ms 11220 KB Output is correct
31 Correct 49 ms 12340 KB Output is correct
32 Correct 50 ms 14188 KB Output is correct
33 Correct 47 ms 12108 KB Output is correct
34 Correct 35 ms 11104 KB Output is correct
35 Correct 35 ms 11104 KB Output is correct
36 Correct 36 ms 11104 KB Output is correct
37 Correct 43 ms 11476 KB Output is correct
38 Correct 36 ms 11104 KB Output is correct
39 Correct 35 ms 11100 KB Output is correct
40 Correct 44 ms 11604 KB Output is correct
41 Correct 34 ms 11104 KB Output is correct
42 Correct 34 ms 11096 KB Output is correct
43 Correct 35 ms 11096 KB Output is correct
44 Correct 34 ms 11092 KB Output is correct
45 Correct 37 ms 11224 KB Output is correct
46 Correct 35 ms 11104 KB Output is correct
47 Correct 40 ms 11348 KB Output is correct
48 Correct 35 ms 11104 KB Output is correct
49 Correct 37 ms 11088 KB Output is correct
50 Correct 64 ms 14320 KB Output is correct
51 Correct 68 ms 12300 KB Output is correct
52 Correct 54 ms 12304 KB Output is correct
53 Correct 63 ms 13964 KB Output is correct
54 Correct 51 ms 11864 KB Output is correct
55 Correct 65 ms 14052 KB Output is correct
56 Correct 64 ms 13996 KB Output is correct
57 Correct 65 ms 14272 KB Output is correct
58 Correct 35 ms 11104 KB Output is correct
59 Correct 36 ms 11104 KB Output is correct
60 Correct 39 ms 11224 KB Output is correct
61 Correct 49 ms 11852 KB Output is correct
62 Correct 49 ms 11860 KB Output is correct
63 Correct 40 ms 11476 KB Output is correct
64 Correct 40 ms 11104 KB Output is correct
65 Correct 52 ms 11832 KB Output is correct
66 Correct 36 ms 11104 KB Output is correct
67 Correct 35 ms 11128 KB Output is correct
68 Correct 37 ms 11076 KB Output is correct
69 Correct 46 ms 11696 KB Output is correct
70 Correct 50 ms 11864 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 12620 KB Output is correct
2 Correct 35 ms 10980 KB Output is correct
3 Correct 35 ms 11096 KB Output is correct
4 Correct 36 ms 11096 KB Output is correct
5 Correct 34 ms 11096 KB Output is correct
6 Correct 35 ms 11104 KB Output is correct
7 Correct 34 ms 11104 KB Output is correct
8 Correct 36 ms 11204 KB Output is correct
9 Correct 93 ms 11068 KB Output is correct
10 Correct 35 ms 11104 KB Output is correct
11 Correct 36 ms 11196 KB Output is correct
12 Correct 36 ms 11224 KB Output is correct
13 Correct 35 ms 11068 KB Output is correct
14 Correct 35 ms 11232 KB Output is correct
15 Correct 35 ms 11104 KB Output is correct
16 Correct 35 ms 11104 KB Output is correct
17 Correct 34 ms 11096 KB Output is correct
18 Correct 35 ms 11096 KB Output is correct
19 Correct 35 ms 11096 KB Output is correct
20 Correct 35 ms 11096 KB Output is correct
21 Correct 41 ms 11096 KB Output is correct
22 Correct 36 ms 11104 KB Output is correct
23 Correct 35 ms 11104 KB Output is correct
24 Correct 35 ms 11104 KB Output is correct
25 Correct 36 ms 11132 KB Output is correct
26 Correct 50 ms 13188 KB Output is correct
27 Correct 46 ms 11740 KB Output is correct
28 Correct 40 ms 11456 KB Output is correct
29 Correct 40 ms 11460 KB Output is correct
30 Correct 37 ms 11220 KB Output is correct
31 Correct 49 ms 12340 KB Output is correct
32 Correct 50 ms 14188 KB Output is correct
33 Correct 47 ms 12108 KB Output is correct
34 Correct 35 ms 11104 KB Output is correct
35 Correct 35 ms 11104 KB Output is correct
36 Correct 36 ms 11104 KB Output is correct
37 Correct 43 ms 11476 KB Output is correct
38 Correct 36 ms 11104 KB Output is correct
39 Correct 35 ms 11100 KB Output is correct
40 Correct 44 ms 11604 KB Output is correct
41 Correct 34 ms 11104 KB Output is correct
42 Correct 34 ms 11096 KB Output is correct
43 Correct 35 ms 11096 KB Output is correct
44 Correct 34 ms 11092 KB Output is correct
45 Correct 37 ms 11224 KB Output is correct
46 Correct 35 ms 11104 KB Output is correct
47 Correct 40 ms 11348 KB Output is correct
48 Correct 35 ms 11104 KB Output is correct
49 Correct 37 ms 11088 KB Output is correct
50 Correct 64 ms 14320 KB Output is correct
51 Correct 68 ms 12300 KB Output is correct
52 Correct 54 ms 12304 KB Output is correct
53 Correct 63 ms 13964 KB Output is correct
54 Correct 51 ms 11864 KB Output is correct
55 Correct 65 ms 14052 KB Output is correct
56 Correct 64 ms 13996 KB Output is correct
57 Correct 65 ms 14272 KB Output is correct
58 Correct 35 ms 11104 KB Output is correct
59 Correct 36 ms 11104 KB Output is correct
60 Correct 39 ms 11224 KB Output is correct
61 Correct 49 ms 11852 KB Output is correct
62 Correct 49 ms 11860 KB Output is correct
63 Correct 40 ms 11476 KB Output is correct
64 Correct 40 ms 11104 KB Output is correct
65 Correct 52 ms 11832 KB Output is correct
66 Correct 36 ms 11104 KB Output is correct
67 Correct 35 ms 11128 KB Output is correct
68 Correct 37 ms 11076 KB Output is correct
69 Correct 46 ms 11696 KB Output is correct
70 Correct 50 ms 11864 KB Output is correct
71 Correct 375 ms 30732 KB Output is correct
72 Correct 278 ms 25856 KB Output is correct
73 Correct 347 ms 28920 KB Output is correct
74 Correct 255 ms 22132 KB Output is correct
75 Correct 251 ms 23796 KB Output is correct
76 Correct 510 ms 38300 KB Output is correct
77 Correct 519 ms 35392 KB Output is correct
78 Correct 421 ms 33048 KB Output is correct
79 Correct 400 ms 31860 KB Output is correct
80 Correct 35 ms 11104 KB Output is correct
81 Correct 35 ms 11104 KB Output is correct
82 Correct 51 ms 12488 KB Output is correct
83 Correct 115 ms 16240 KB Output is correct
84 Correct 127 ms 17020 KB Output is correct
85 Correct 79 ms 15096 KB Output is correct
86 Correct 40 ms 11480 KB Output is correct
87 Correct 138 ms 17788 KB Output is correct
88 Correct 36 ms 11104 KB Output is correct
89 Correct 35 ms 11104 KB Output is correct
90 Correct 44 ms 11604 KB Output is correct
91 Correct 92 ms 14964 KB Output is correct
92 Correct 158 ms 18348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 12620 KB Output is correct
2 Correct 35 ms 10980 KB Output is correct
3 Correct 35 ms 11096 KB Output is correct
4 Correct 36 ms 11096 KB Output is correct
5 Correct 34 ms 11096 KB Output is correct
6 Correct 35 ms 11104 KB Output is correct
7 Correct 34 ms 11104 KB Output is correct
8 Correct 36 ms 11204 KB Output is correct
9 Correct 93 ms 11068 KB Output is correct
10 Correct 35 ms 11104 KB Output is correct
11 Correct 36 ms 11196 KB Output is correct
12 Correct 36 ms 11224 KB Output is correct
13 Correct 35 ms 11068 KB Output is correct
14 Correct 35 ms 11232 KB Output is correct
15 Correct 35 ms 11104 KB Output is correct
16 Correct 35 ms 11104 KB Output is correct
17 Correct 34 ms 11096 KB Output is correct
18 Correct 35 ms 11096 KB Output is correct
19 Correct 35 ms 11096 KB Output is correct
20 Correct 35 ms 11096 KB Output is correct
21 Correct 41 ms 11096 KB Output is correct
22 Correct 36 ms 11104 KB Output is correct
23 Correct 35 ms 11104 KB Output is correct
24 Correct 35 ms 11104 KB Output is correct
25 Correct 36 ms 11132 KB Output is correct
26 Correct 50 ms 13188 KB Output is correct
27 Correct 46 ms 11740 KB Output is correct
28 Correct 40 ms 11456 KB Output is correct
29 Correct 40 ms 11460 KB Output is correct
30 Correct 37 ms 11220 KB Output is correct
31 Correct 49 ms 12340 KB Output is correct
32 Correct 50 ms 14188 KB Output is correct
33 Correct 47 ms 12108 KB Output is correct
34 Correct 35 ms 11104 KB Output is correct
35 Correct 35 ms 11104 KB Output is correct
36 Correct 36 ms 11104 KB Output is correct
37 Correct 43 ms 11476 KB Output is correct
38 Correct 36 ms 11104 KB Output is correct
39 Correct 35 ms 11100 KB Output is correct
40 Correct 44 ms 11604 KB Output is correct
41 Correct 34 ms 11104 KB Output is correct
42 Correct 34 ms 11096 KB Output is correct
43 Correct 35 ms 11096 KB Output is correct
44 Correct 34 ms 11092 KB Output is correct
45 Correct 37 ms 11224 KB Output is correct
46 Correct 35 ms 11104 KB Output is correct
47 Correct 40 ms 11348 KB Output is correct
48 Correct 35 ms 11104 KB Output is correct
49 Correct 37 ms 11088 KB Output is correct
50 Correct 64 ms 14320 KB Output is correct
51 Correct 68 ms 12300 KB Output is correct
52 Correct 54 ms 12304 KB Output is correct
53 Correct 63 ms 13964 KB Output is correct
54 Correct 51 ms 11864 KB Output is correct
55 Correct 65 ms 14052 KB Output is correct
56 Correct 64 ms 13996 KB Output is correct
57 Correct 65 ms 14272 KB Output is correct
58 Correct 35 ms 11104 KB Output is correct
59 Correct 36 ms 11104 KB Output is correct
60 Correct 39 ms 11224 KB Output is correct
61 Correct 49 ms 11852 KB Output is correct
62 Correct 49 ms 11860 KB Output is correct
63 Correct 40 ms 11476 KB Output is correct
64 Correct 40 ms 11104 KB Output is correct
65 Correct 52 ms 11832 KB Output is correct
66 Correct 36 ms 11104 KB Output is correct
67 Correct 35 ms 11128 KB Output is correct
68 Correct 37 ms 11076 KB Output is correct
69 Correct 46 ms 11696 KB Output is correct
70 Correct 50 ms 11864 KB Output is correct
71 Correct 375 ms 30732 KB Output is correct
72 Correct 278 ms 25856 KB Output is correct
73 Correct 347 ms 28920 KB Output is correct
74 Correct 255 ms 22132 KB Output is correct
75 Correct 251 ms 23796 KB Output is correct
76 Correct 510 ms 38300 KB Output is correct
77 Correct 519 ms 35392 KB Output is correct
78 Correct 421 ms 33048 KB Output is correct
79 Correct 400 ms 31860 KB Output is correct
80 Correct 35 ms 11104 KB Output is correct
81 Correct 35 ms 11104 KB Output is correct
82 Correct 51 ms 12488 KB Output is correct
83 Correct 115 ms 16240 KB Output is correct
84 Correct 127 ms 17020 KB Output is correct
85 Correct 79 ms 15096 KB Output is correct
86 Correct 40 ms 11480 KB Output is correct
87 Correct 138 ms 17788 KB Output is correct
88 Correct 36 ms 11104 KB Output is correct
89 Correct 35 ms 11104 KB Output is correct
90 Correct 44 ms 11604 KB Output is correct
91 Correct 92 ms 14964 KB Output is correct
92 Correct 158 ms 18348 KB Output is correct
93 Correct 1708 ms 78272 KB Output is correct
94 Correct 994 ms 67764 KB Output is correct
95 Correct 1135 ms 72484 KB Output is correct
96 Correct 1012 ms 66296 KB Output is correct
97 Correct 892 ms 60276 KB Output is correct
98 Correct 1922 ms 87668 KB Output is correct
99 Correct 1986 ms 89928 KB Output is correct
100 Correct 1905 ms 83968 KB Output is correct
101 Correct 1766 ms 87604 KB Output is correct
102 Correct 1615 ms 83392 KB Output is correct
103 Correct 1253 ms 79204 KB Output is correct
104 Correct 36 ms 11356 KB Output is correct
105 Correct 36 ms 11104 KB Output is correct
106 Correct 64 ms 14156 KB Output is correct
107 Correct 197 ms 24540 KB Output is correct
108 Correct 396 ms 38392 KB Output is correct
109 Correct 103 ms 16900 KB Output is correct
110 Correct 35 ms 11104 KB Output is correct
111 Correct 247 ms 27028 KB Output is correct
112 Correct 41 ms 11104 KB Output is correct
113 Correct 43 ms 11092 KB Output is correct
114 Correct 80 ms 13996 KB Output is correct
115 Correct 41 ms 11100 KB Output is correct
116 Correct 82 ms 14968 KB Output is correct
117 Correct 436 ms 37060 KB Output is correct