답안 #536852

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
536852 2022-03-14T06:09:14 Z ecx Toys (CEOI18_toy) C++17
100 / 100
1208 ms 152176 KB
#include <bits/stdc++.h>
#include <bits/extc++.h>
using namespace __gnu_pbds;
using namespace std;
typedef long long ll;

struct chash {
    const uint64_t C = ll(4e18 * acos(0)) | 71;
    ll operator()(ll x) const {
        return __builtin_bswap64(x*C);
    }
};

gp_hash_table<ll, ll, chash> h({}, {}, {}, {}, {1<<16});

bool srch(int n, int k) {
    ll key = ((ll)n)<<32;
    key += k;
    if (h.find(key) == h.end()) {
        h.insert({key,key});
        return false;
    }
    return true;
}

set<int> s;
void dp(int n, int built) {
    if (srch(n, built)) return;
    s.insert(n+built-1);

    for (int i = 2; i*i<=n; i++) {
        if (n%i==0) {
            dp(n/i, built+i-1);
        }
    }
}

int main() {

    int n;
    cin >> n;
    dp(n, 0);
    cout << s.size() << endl;
    for (int k : s) cout << k << " ";
    cout << endl;

}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 2 ms 1748 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 2 ms 1776 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 1748 KB Output is correct
15 Correct 1 ms 1792 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1824 KB Output is correct
18 Correct 1 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 2 ms 1748 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 2 ms 1776 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 1748 KB Output is correct
15 Correct 1 ms 1792 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1824 KB Output is correct
18 Correct 1 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 2 ms 1748 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 1 ms 1748 KB Output is correct
29 Correct 1 ms 1748 KB Output is correct
30 Correct 2 ms 1748 KB Output is correct
31 Correct 2 ms 1748 KB Output is correct
32 Correct 1 ms 1748 KB Output is correct
33 Correct 2 ms 1748 KB Output is correct
34 Correct 2 ms 1748 KB Output is correct
35 Correct 2 ms 1748 KB Output is correct
36 Correct 1 ms 1748 KB Output is correct
37 Correct 1 ms 1780 KB Output is correct
38 Correct 1 ms 1748 KB Output is correct
39 Correct 1 ms 1748 KB Output is correct
40 Correct 2 ms 1748 KB Output is correct
41 Correct 2 ms 1748 KB Output is correct
42 Correct 1 ms 1748 KB Output is correct
43 Correct 1 ms 1748 KB Output is correct
44 Correct 1 ms 1748 KB Output is correct
45 Correct 1 ms 1748 KB Output is correct
46 Correct 1 ms 1748 KB Output is correct
47 Correct 1 ms 1748 KB Output is correct
48 Correct 1 ms 1748 KB Output is correct
49 Correct 1 ms 1748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 2 ms 1748 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 2 ms 1776 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 1748 KB Output is correct
15 Correct 1 ms 1792 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1824 KB Output is correct
18 Correct 1 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 2 ms 1748 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 1 ms 1748 KB Output is correct
29 Correct 1 ms 1748 KB Output is correct
30 Correct 2 ms 1748 KB Output is correct
31 Correct 2 ms 1748 KB Output is correct
32 Correct 1 ms 1748 KB Output is correct
33 Correct 2 ms 1748 KB Output is correct
34 Correct 2 ms 1748 KB Output is correct
35 Correct 2 ms 1748 KB Output is correct
36 Correct 1 ms 1748 KB Output is correct
37 Correct 1 ms 1780 KB Output is correct
38 Correct 1 ms 1748 KB Output is correct
39 Correct 1 ms 1748 KB Output is correct
40 Correct 2 ms 1748 KB Output is correct
41 Correct 2 ms 1748 KB Output is correct
42 Correct 1 ms 1748 KB Output is correct
43 Correct 1 ms 1748 KB Output is correct
44 Correct 1 ms 1748 KB Output is correct
45 Correct 1 ms 1748 KB Output is correct
46 Correct 1 ms 1748 KB Output is correct
47 Correct 1 ms 1748 KB Output is correct
48 Correct 1 ms 1748 KB Output is correct
49 Correct 1 ms 1748 KB Output is correct
50 Correct 3 ms 1876 KB Output is correct
51 Correct 2 ms 1876 KB Output is correct
52 Correct 2 ms 1876 KB Output is correct
53 Correct 2 ms 1876 KB Output is correct
54 Correct 1 ms 1748 KB Output is correct
55 Correct 3 ms 1876 KB Output is correct
56 Correct 2 ms 1876 KB Output is correct
57 Correct 2 ms 1876 KB Output is correct
58 Correct 1 ms 1748 KB Output is correct
59 Correct 2 ms 1748 KB Output is correct
60 Correct 1 ms 1744 KB Output is correct
61 Correct 2 ms 1876 KB Output is correct
62 Correct 2 ms 1748 KB Output is correct
63 Correct 1 ms 1748 KB Output is correct
64 Correct 1 ms 1748 KB Output is correct
65 Correct 1 ms 1876 KB Output is correct
66 Correct 1 ms 1748 KB Output is correct
67 Correct 1 ms 1748 KB Output is correct
68 Correct 1 ms 1748 KB Output is correct
69 Correct 1 ms 1748 KB Output is correct
70 Correct 1 ms 1748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 2 ms 1748 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 2 ms 1776 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 1748 KB Output is correct
15 Correct 1 ms 1792 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1824 KB Output is correct
18 Correct 1 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 2 ms 1748 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 1 ms 1748 KB Output is correct
29 Correct 1 ms 1748 KB Output is correct
30 Correct 2 ms 1748 KB Output is correct
31 Correct 2 ms 1748 KB Output is correct
32 Correct 1 ms 1748 KB Output is correct
33 Correct 2 ms 1748 KB Output is correct
34 Correct 2 ms 1748 KB Output is correct
35 Correct 2 ms 1748 KB Output is correct
36 Correct 1 ms 1748 KB Output is correct
37 Correct 1 ms 1780 KB Output is correct
38 Correct 1 ms 1748 KB Output is correct
39 Correct 1 ms 1748 KB Output is correct
40 Correct 2 ms 1748 KB Output is correct
41 Correct 2 ms 1748 KB Output is correct
42 Correct 1 ms 1748 KB Output is correct
43 Correct 1 ms 1748 KB Output is correct
44 Correct 1 ms 1748 KB Output is correct
45 Correct 1 ms 1748 KB Output is correct
46 Correct 1 ms 1748 KB Output is correct
47 Correct 1 ms 1748 KB Output is correct
48 Correct 1 ms 1748 KB Output is correct
49 Correct 1 ms 1748 KB Output is correct
50 Correct 3 ms 1876 KB Output is correct
51 Correct 2 ms 1876 KB Output is correct
52 Correct 2 ms 1876 KB Output is correct
53 Correct 2 ms 1876 KB Output is correct
54 Correct 1 ms 1748 KB Output is correct
55 Correct 3 ms 1876 KB Output is correct
56 Correct 2 ms 1876 KB Output is correct
57 Correct 2 ms 1876 KB Output is correct
58 Correct 1 ms 1748 KB Output is correct
59 Correct 2 ms 1748 KB Output is correct
60 Correct 1 ms 1744 KB Output is correct
61 Correct 2 ms 1876 KB Output is correct
62 Correct 2 ms 1748 KB Output is correct
63 Correct 1 ms 1748 KB Output is correct
64 Correct 1 ms 1748 KB Output is correct
65 Correct 1 ms 1876 KB Output is correct
66 Correct 1 ms 1748 KB Output is correct
67 Correct 1 ms 1748 KB Output is correct
68 Correct 1 ms 1748 KB Output is correct
69 Correct 1 ms 1748 KB Output is correct
70 Correct 1 ms 1748 KB Output is correct
71 Correct 172 ms 38324 KB Output is correct
72 Correct 133 ms 19628 KB Output is correct
73 Correct 134 ms 19620 KB Output is correct
74 Correct 78 ms 19460 KB Output is correct
75 Correct 85 ms 19496 KB Output is correct
76 Correct 270 ms 38572 KB Output is correct
77 Correct 198 ms 38396 KB Output is correct
78 Correct 205 ms 38412 KB Output is correct
79 Correct 202 ms 38432 KB Output is correct
80 Correct 1 ms 1748 KB Output is correct
81 Correct 1 ms 1748 KB Output is correct
82 Correct 3 ms 1876 KB Output is correct
83 Correct 19 ms 5200 KB Output is correct
84 Correct 22 ms 5272 KB Output is correct
85 Correct 8 ms 1952 KB Output is correct
86 Correct 2 ms 1748 KB Output is correct
87 Correct 32 ms 5320 KB Output is correct
88 Correct 1 ms 1748 KB Output is correct
89 Correct 2 ms 1748 KB Output is correct
90 Correct 3 ms 1748 KB Output is correct
91 Correct 13 ms 2132 KB Output is correct
92 Correct 44 ms 10136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1748 KB Output is correct
2 Correct 1 ms 1748 KB Output is correct
3 Correct 1 ms 1748 KB Output is correct
4 Correct 2 ms 1748 KB Output is correct
5 Correct 1 ms 1748 KB Output is correct
6 Correct 1 ms 1748 KB Output is correct
7 Correct 2 ms 1748 KB Output is correct
8 Correct 1 ms 1748 KB Output is correct
9 Correct 1 ms 1748 KB Output is correct
10 Correct 1 ms 1748 KB Output is correct
11 Correct 2 ms 1748 KB Output is correct
12 Correct 2 ms 1776 KB Output is correct
13 Correct 1 ms 1748 KB Output is correct
14 Correct 1 ms 1748 KB Output is correct
15 Correct 1 ms 1792 KB Output is correct
16 Correct 2 ms 1748 KB Output is correct
17 Correct 1 ms 1824 KB Output is correct
18 Correct 1 ms 1748 KB Output is correct
19 Correct 2 ms 1748 KB Output is correct
20 Correct 2 ms 1748 KB Output is correct
21 Correct 2 ms 1748 KB Output is correct
22 Correct 1 ms 1748 KB Output is correct
23 Correct 1 ms 1748 KB Output is correct
24 Correct 2 ms 1748 KB Output is correct
25 Correct 1 ms 1748 KB Output is correct
26 Correct 2 ms 1748 KB Output is correct
27 Correct 2 ms 1748 KB Output is correct
28 Correct 1 ms 1748 KB Output is correct
29 Correct 1 ms 1748 KB Output is correct
30 Correct 2 ms 1748 KB Output is correct
31 Correct 2 ms 1748 KB Output is correct
32 Correct 1 ms 1748 KB Output is correct
33 Correct 2 ms 1748 KB Output is correct
34 Correct 2 ms 1748 KB Output is correct
35 Correct 2 ms 1748 KB Output is correct
36 Correct 1 ms 1748 KB Output is correct
37 Correct 1 ms 1780 KB Output is correct
38 Correct 1 ms 1748 KB Output is correct
39 Correct 1 ms 1748 KB Output is correct
40 Correct 2 ms 1748 KB Output is correct
41 Correct 2 ms 1748 KB Output is correct
42 Correct 1 ms 1748 KB Output is correct
43 Correct 1 ms 1748 KB Output is correct
44 Correct 1 ms 1748 KB Output is correct
45 Correct 1 ms 1748 KB Output is correct
46 Correct 1 ms 1748 KB Output is correct
47 Correct 1 ms 1748 KB Output is correct
48 Correct 1 ms 1748 KB Output is correct
49 Correct 1 ms 1748 KB Output is correct
50 Correct 3 ms 1876 KB Output is correct
51 Correct 2 ms 1876 KB Output is correct
52 Correct 2 ms 1876 KB Output is correct
53 Correct 2 ms 1876 KB Output is correct
54 Correct 1 ms 1748 KB Output is correct
55 Correct 3 ms 1876 KB Output is correct
56 Correct 2 ms 1876 KB Output is correct
57 Correct 2 ms 1876 KB Output is correct
58 Correct 1 ms 1748 KB Output is correct
59 Correct 2 ms 1748 KB Output is correct
60 Correct 1 ms 1744 KB Output is correct
61 Correct 2 ms 1876 KB Output is correct
62 Correct 2 ms 1748 KB Output is correct
63 Correct 1 ms 1748 KB Output is correct
64 Correct 1 ms 1748 KB Output is correct
65 Correct 1 ms 1876 KB Output is correct
66 Correct 1 ms 1748 KB Output is correct
67 Correct 1 ms 1748 KB Output is correct
68 Correct 1 ms 1748 KB Output is correct
69 Correct 1 ms 1748 KB Output is correct
70 Correct 1 ms 1748 KB Output is correct
71 Correct 172 ms 38324 KB Output is correct
72 Correct 133 ms 19628 KB Output is correct
73 Correct 134 ms 19620 KB Output is correct
74 Correct 78 ms 19460 KB Output is correct
75 Correct 85 ms 19496 KB Output is correct
76 Correct 270 ms 38572 KB Output is correct
77 Correct 198 ms 38396 KB Output is correct
78 Correct 205 ms 38412 KB Output is correct
79 Correct 202 ms 38432 KB Output is correct
80 Correct 1 ms 1748 KB Output is correct
81 Correct 1 ms 1748 KB Output is correct
82 Correct 3 ms 1876 KB Output is correct
83 Correct 19 ms 5200 KB Output is correct
84 Correct 22 ms 5272 KB Output is correct
85 Correct 8 ms 1952 KB Output is correct
86 Correct 2 ms 1748 KB Output is correct
87 Correct 32 ms 5320 KB Output is correct
88 Correct 1 ms 1748 KB Output is correct
89 Correct 2 ms 1748 KB Output is correct
90 Correct 3 ms 1748 KB Output is correct
91 Correct 13 ms 2132 KB Output is correct
92 Correct 44 ms 10136 KB Output is correct
93 Correct 1033 ms 151692 KB Output is correct
94 Correct 673 ms 77152 KB Output is correct
95 Correct 665 ms 77084 KB Output is correct
96 Correct 566 ms 76620 KB Output is correct
97 Correct 544 ms 76460 KB Output is correct
98 Correct 1208 ms 152108 KB Output is correct
99 Correct 1159 ms 152176 KB Output is correct
100 Correct 1185 ms 151944 KB Output is correct
101 Correct 1091 ms 151756 KB Output is correct
102 Correct 937 ms 151484 KB Output is correct
103 Correct 774 ms 77456 KB Output is correct
104 Correct 1 ms 1748 KB Output is correct
105 Correct 2 ms 1748 KB Output is correct
106 Correct 5 ms 1876 KB Output is correct
107 Correct 90 ms 19600 KB Output is correct
108 Correct 215 ms 38708 KB Output is correct
109 Correct 27 ms 5260 KB Output is correct
110 Correct 2 ms 1748 KB Output is correct
111 Correct 117 ms 19824 KB Output is correct
112 Correct 2 ms 1748 KB Output is correct
113 Correct 2 ms 1748 KB Output is correct
114 Correct 9 ms 1932 KB Output is correct
115 Correct 1 ms 1748 KB Output is correct
116 Correct 19 ms 2032 KB Output is correct
117 Correct 248 ms 39076 KB Output is correct