답안 #893522

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
893522 2023-12-27T06:15:24 Z vjudge1 Toys (CEOI18_toy) C++17
59 / 100
43 ms 20056 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(), x.end()

const int N = (int)2e5 + 5;
const int MAX = (int)1e8 + 5;
const ll mod = (int)1e9 + 7;
const ll inf = (int)(1e9) + 100;

int n;
vector<int> dv[N], ans;
bitset<MAX> b;

void rec(int c = 1, int sum = 0, int val = n) {
    if (c == n) {
        if (b[sum] == 0) ans.pb(sum);
        b[sum] = 1;
        return;
    }
    for (auto i : dv[val]) {
        rec(c * i, sum + (i - 1), val / i);
    }
}

void solve() {
    cin >> n;
    for (int i = 2; i <= n; i++) {
        for (int j = i; j <= n; j += i) {
            dv[j].pb(i);
        }
    }
    rec();
    cout << sz(ans) << "\n";
    sort(all(ans));
    for (int i : ans) cout << i << " ";
}

signed main() {
    ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    int T = 1;
    //cin >> T;
    while (T--) solve();
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 1 ms 7000 KB Output is correct
4 Correct 3 ms 6944 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 1 ms 6744 KB Output is correct
9 Correct 1 ms 6748 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6812 KB Output is correct
13 Correct 2 ms 6748 KB Output is correct
14 Correct 1 ms 6956 KB Output is correct
15 Correct 1 ms 6744 KB Output is correct
16 Correct 1 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 1 ms 6748 KB Output is correct
19 Correct 1 ms 6748 KB Output is correct
20 Correct 1 ms 6748 KB Output is correct
21 Correct 1 ms 6748 KB Output is correct
22 Correct 1 ms 7000 KB Output is correct
23 Correct 1 ms 6748 KB Output is correct
24 Correct 1 ms 6748 KB Output is correct
25 Correct 2 ms 6748 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 1 ms 7000 KB Output is correct
4 Correct 3 ms 6944 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 1 ms 6744 KB Output is correct
9 Correct 1 ms 6748 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6812 KB Output is correct
13 Correct 2 ms 6748 KB Output is correct
14 Correct 1 ms 6956 KB Output is correct
15 Correct 1 ms 6744 KB Output is correct
16 Correct 1 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 1 ms 6748 KB Output is correct
19 Correct 1 ms 6748 KB Output is correct
20 Correct 1 ms 6748 KB Output is correct
21 Correct 1 ms 6748 KB Output is correct
22 Correct 1 ms 7000 KB Output is correct
23 Correct 1 ms 6748 KB Output is correct
24 Correct 1 ms 6748 KB Output is correct
25 Correct 2 ms 6748 KB Output is correct
26 Correct 3 ms 7256 KB Output is correct
27 Correct 2 ms 7260 KB Output is correct
28 Correct 2 ms 7100 KB Output is correct
29 Correct 2 ms 7004 KB Output is correct
30 Correct 2 ms 7000 KB Output is correct
31 Correct 4 ms 7516 KB Output is correct
32 Correct 3 ms 7260 KB Output is correct
33 Correct 3 ms 7260 KB Output is correct
34 Correct 3 ms 7516 KB Output is correct
35 Correct 3 ms 7516 KB Output is correct
36 Correct 3 ms 7260 KB Output is correct
37 Correct 3 ms 7260 KB Output is correct
38 Correct 3 ms 7516 KB Output is correct
39 Correct 3 ms 7516 KB Output is correct
40 Correct 4 ms 7516 KB Output is correct
41 Correct 3 ms 7516 KB Output is correct
42 Correct 3 ms 7516 KB Output is correct
43 Correct 3 ms 7516 KB Output is correct
44 Correct 4 ms 7516 KB Output is correct
45 Correct 3 ms 7396 KB Output is correct
46 Correct 3 ms 7516 KB Output is correct
47 Correct 3 ms 7604 KB Output is correct
48 Correct 3 ms 7516 KB Output is correct
49 Correct 3 ms 7516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 1 ms 7000 KB Output is correct
4 Correct 3 ms 6944 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 1 ms 6744 KB Output is correct
9 Correct 1 ms 6748 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6812 KB Output is correct
13 Correct 2 ms 6748 KB Output is correct
14 Correct 1 ms 6956 KB Output is correct
15 Correct 1 ms 6744 KB Output is correct
16 Correct 1 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 1 ms 6748 KB Output is correct
19 Correct 1 ms 6748 KB Output is correct
20 Correct 1 ms 6748 KB Output is correct
21 Correct 1 ms 6748 KB Output is correct
22 Correct 1 ms 7000 KB Output is correct
23 Correct 1 ms 6748 KB Output is correct
24 Correct 1 ms 6748 KB Output is correct
25 Correct 2 ms 6748 KB Output is correct
26 Correct 3 ms 7256 KB Output is correct
27 Correct 2 ms 7260 KB Output is correct
28 Correct 2 ms 7100 KB Output is correct
29 Correct 2 ms 7004 KB Output is correct
30 Correct 2 ms 7000 KB Output is correct
31 Correct 4 ms 7516 KB Output is correct
32 Correct 3 ms 7260 KB Output is correct
33 Correct 3 ms 7260 KB Output is correct
34 Correct 3 ms 7516 KB Output is correct
35 Correct 3 ms 7516 KB Output is correct
36 Correct 3 ms 7260 KB Output is correct
37 Correct 3 ms 7260 KB Output is correct
38 Correct 3 ms 7516 KB Output is correct
39 Correct 3 ms 7516 KB Output is correct
40 Correct 4 ms 7516 KB Output is correct
41 Correct 3 ms 7516 KB Output is correct
42 Correct 3 ms 7516 KB Output is correct
43 Correct 3 ms 7516 KB Output is correct
44 Correct 4 ms 7516 KB Output is correct
45 Correct 3 ms 7396 KB Output is correct
46 Correct 3 ms 7516 KB Output is correct
47 Correct 3 ms 7604 KB Output is correct
48 Correct 3 ms 7516 KB Output is correct
49 Correct 3 ms 7516 KB Output is correct
50 Correct 25 ms 13148 KB Output is correct
51 Correct 16 ms 10844 KB Output is correct
52 Correct 18 ms 10588 KB Output is correct
53 Correct 15 ms 10076 KB Output is correct
54 Correct 8 ms 8740 KB Output is correct
55 Correct 43 ms 13660 KB Output is correct
56 Correct 37 ms 13004 KB Output is correct
57 Correct 26 ms 12376 KB Output is correct
58 Correct 25 ms 14424 KB Output is correct
59 Correct 24 ms 14168 KB Output is correct
60 Correct 16 ms 11612 KB Output is correct
61 Correct 33 ms 13916 KB Output is correct
62 Correct 8 ms 8792 KB Output is correct
63 Correct 25 ms 14440 KB Output is correct
64 Correct 24 ms 14428 KB Output is correct
65 Correct 24 ms 13656 KB Output is correct
66 Correct 26 ms 14416 KB Output is correct
67 Correct 25 ms 14424 KB Output is correct
68 Correct 25 ms 14460 KB Output is correct
69 Correct 25 ms 14428 KB Output is correct
70 Correct 23 ms 13660 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 1 ms 7000 KB Output is correct
4 Correct 3 ms 6944 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 1 ms 6744 KB Output is correct
9 Correct 1 ms 6748 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6812 KB Output is correct
13 Correct 2 ms 6748 KB Output is correct
14 Correct 1 ms 6956 KB Output is correct
15 Correct 1 ms 6744 KB Output is correct
16 Correct 1 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 1 ms 6748 KB Output is correct
19 Correct 1 ms 6748 KB Output is correct
20 Correct 1 ms 6748 KB Output is correct
21 Correct 1 ms 6748 KB Output is correct
22 Correct 1 ms 7000 KB Output is correct
23 Correct 1 ms 6748 KB Output is correct
24 Correct 1 ms 6748 KB Output is correct
25 Correct 2 ms 6748 KB Output is correct
26 Correct 3 ms 7256 KB Output is correct
27 Correct 2 ms 7260 KB Output is correct
28 Correct 2 ms 7100 KB Output is correct
29 Correct 2 ms 7004 KB Output is correct
30 Correct 2 ms 7000 KB Output is correct
31 Correct 4 ms 7516 KB Output is correct
32 Correct 3 ms 7260 KB Output is correct
33 Correct 3 ms 7260 KB Output is correct
34 Correct 3 ms 7516 KB Output is correct
35 Correct 3 ms 7516 KB Output is correct
36 Correct 3 ms 7260 KB Output is correct
37 Correct 3 ms 7260 KB Output is correct
38 Correct 3 ms 7516 KB Output is correct
39 Correct 3 ms 7516 KB Output is correct
40 Correct 4 ms 7516 KB Output is correct
41 Correct 3 ms 7516 KB Output is correct
42 Correct 3 ms 7516 KB Output is correct
43 Correct 3 ms 7516 KB Output is correct
44 Correct 4 ms 7516 KB Output is correct
45 Correct 3 ms 7396 KB Output is correct
46 Correct 3 ms 7516 KB Output is correct
47 Correct 3 ms 7604 KB Output is correct
48 Correct 3 ms 7516 KB Output is correct
49 Correct 3 ms 7516 KB Output is correct
50 Correct 25 ms 13148 KB Output is correct
51 Correct 16 ms 10844 KB Output is correct
52 Correct 18 ms 10588 KB Output is correct
53 Correct 15 ms 10076 KB Output is correct
54 Correct 8 ms 8740 KB Output is correct
55 Correct 43 ms 13660 KB Output is correct
56 Correct 37 ms 13004 KB Output is correct
57 Correct 26 ms 12376 KB Output is correct
58 Correct 25 ms 14424 KB Output is correct
59 Correct 24 ms 14168 KB Output is correct
60 Correct 16 ms 11612 KB Output is correct
61 Correct 33 ms 13916 KB Output is correct
62 Correct 8 ms 8792 KB Output is correct
63 Correct 25 ms 14440 KB Output is correct
64 Correct 24 ms 14428 KB Output is correct
65 Correct 24 ms 13656 KB Output is correct
66 Correct 26 ms 14416 KB Output is correct
67 Correct 25 ms 14424 KB Output is correct
68 Correct 25 ms 14460 KB Output is correct
69 Correct 25 ms 14428 KB Output is correct
70 Correct 23 ms 13660 KB Output is correct
71 Runtime error 11 ms 20056 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 6748 KB Output is correct
2 Correct 1 ms 6748 KB Output is correct
3 Correct 1 ms 7000 KB Output is correct
4 Correct 3 ms 6944 KB Output is correct
5 Correct 2 ms 6748 KB Output is correct
6 Correct 1 ms 6748 KB Output is correct
7 Correct 1 ms 6744 KB Output is correct
8 Correct 1 ms 6744 KB Output is correct
9 Correct 1 ms 6748 KB Output is correct
10 Correct 1 ms 6748 KB Output is correct
11 Correct 1 ms 6748 KB Output is correct
12 Correct 1 ms 6812 KB Output is correct
13 Correct 2 ms 6748 KB Output is correct
14 Correct 1 ms 6956 KB Output is correct
15 Correct 1 ms 6744 KB Output is correct
16 Correct 1 ms 6748 KB Output is correct
17 Correct 2 ms 6748 KB Output is correct
18 Correct 1 ms 6748 KB Output is correct
19 Correct 1 ms 6748 KB Output is correct
20 Correct 1 ms 6748 KB Output is correct
21 Correct 1 ms 6748 KB Output is correct
22 Correct 1 ms 7000 KB Output is correct
23 Correct 1 ms 6748 KB Output is correct
24 Correct 1 ms 6748 KB Output is correct
25 Correct 2 ms 6748 KB Output is correct
26 Correct 3 ms 7256 KB Output is correct
27 Correct 2 ms 7260 KB Output is correct
28 Correct 2 ms 7100 KB Output is correct
29 Correct 2 ms 7004 KB Output is correct
30 Correct 2 ms 7000 KB Output is correct
31 Correct 4 ms 7516 KB Output is correct
32 Correct 3 ms 7260 KB Output is correct
33 Correct 3 ms 7260 KB Output is correct
34 Correct 3 ms 7516 KB Output is correct
35 Correct 3 ms 7516 KB Output is correct
36 Correct 3 ms 7260 KB Output is correct
37 Correct 3 ms 7260 KB Output is correct
38 Correct 3 ms 7516 KB Output is correct
39 Correct 3 ms 7516 KB Output is correct
40 Correct 4 ms 7516 KB Output is correct
41 Correct 3 ms 7516 KB Output is correct
42 Correct 3 ms 7516 KB Output is correct
43 Correct 3 ms 7516 KB Output is correct
44 Correct 4 ms 7516 KB Output is correct
45 Correct 3 ms 7396 KB Output is correct
46 Correct 3 ms 7516 KB Output is correct
47 Correct 3 ms 7604 KB Output is correct
48 Correct 3 ms 7516 KB Output is correct
49 Correct 3 ms 7516 KB Output is correct
50 Correct 25 ms 13148 KB Output is correct
51 Correct 16 ms 10844 KB Output is correct
52 Correct 18 ms 10588 KB Output is correct
53 Correct 15 ms 10076 KB Output is correct
54 Correct 8 ms 8740 KB Output is correct
55 Correct 43 ms 13660 KB Output is correct
56 Correct 37 ms 13004 KB Output is correct
57 Correct 26 ms 12376 KB Output is correct
58 Correct 25 ms 14424 KB Output is correct
59 Correct 24 ms 14168 KB Output is correct
60 Correct 16 ms 11612 KB Output is correct
61 Correct 33 ms 13916 KB Output is correct
62 Correct 8 ms 8792 KB Output is correct
63 Correct 25 ms 14440 KB Output is correct
64 Correct 24 ms 14428 KB Output is correct
65 Correct 24 ms 13656 KB Output is correct
66 Correct 26 ms 14416 KB Output is correct
67 Correct 25 ms 14424 KB Output is correct
68 Correct 25 ms 14460 KB Output is correct
69 Correct 25 ms 14428 KB Output is correct
70 Correct 23 ms 13660 KB Output is correct
71 Runtime error 11 ms 20056 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -