답안 #583676

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
583676 2022-06-26T03:55:43 Z talant117408 Toys (CEOI18_toy) C++17
59 / 100
752 ms 262144 KB
#include <bits/stdc++.h>
 
using namespace std;
 
typedef long long ll;
typedef pair <int, int> pii;
typedef pair <ll, ll> pll;

#define long                unsigned long 
#define pb                  push_back
#define mp                  make_pair
#define all(v)              (v).begin(),(v).end()
#define rall(v)             (v).rbegin(),(v).rend()
#define lb                  lower_bound
#define ub                  upper_bound
#define sz(v)               int((v).size())
#define do_not_disturb      ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl                '\n'
#define PI                  2*acos(0.0)

void solve() {
    int n;
    cin >> n;
    
    set <int> dp[n+1];
    dp[1].insert(0);
    for (int i = 2; i <= n; i++) {
        for (int j = 1; j*j <= i; j++) {
            if (i%j == 0) {
                for (auto to : dp[j]) {
                    dp[i].insert(to+i/j-1);
                }
                if (i/j != j) {
                    for (auto to : dp[i/j]) {
                        dp[i].insert(to+j-1);
                    }
                }
            }
        }
    }
    
    cout << sz(dp[n]) << endl;
    for (auto to : dp[n]) cout << to << ' ';
}

int main() {
    do_not_disturb
    
    int t = 1;
    //~ cin >> t;
    while (t--) {
        solve();
    }
    
    return 0;
}
/*

*/
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 20 ms 4604 KB Output is correct
27 Correct 13 ms 2900 KB Output is correct
28 Correct 6 ms 1364 KB Output is correct
29 Correct 3 ms 956 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 25 ms 5444 KB Output is correct
32 Correct 25 ms 4376 KB Output is correct
33 Correct 19 ms 4088 KB Output is correct
34 Correct 31 ms 6348 KB Output is correct
35 Correct 28 ms 6232 KB Output is correct
36 Correct 22 ms 5056 KB Output is correct
37 Correct 20 ms 4740 KB Output is correct
38 Correct 29 ms 6348 KB Output is correct
39 Correct 27 ms 6428 KB Output is correct
40 Correct 30 ms 5708 KB Output is correct
41 Correct 29 ms 6372 KB Output is correct
42 Correct 37 ms 6272 KB Output is correct
43 Correct 28 ms 5684 KB Output is correct
44 Correct 31 ms 6352 KB Output is correct
45 Correct 30 ms 6456 KB Output is correct
46 Correct 29 ms 6356 KB Output is correct
47 Correct 35 ms 6312 KB Output is correct
48 Correct 36 ms 6368 KB Output is correct
49 Correct 36 ms 6348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 20 ms 4604 KB Output is correct
27 Correct 13 ms 2900 KB Output is correct
28 Correct 6 ms 1364 KB Output is correct
29 Correct 3 ms 956 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 25 ms 5444 KB Output is correct
32 Correct 25 ms 4376 KB Output is correct
33 Correct 19 ms 4088 KB Output is correct
34 Correct 31 ms 6348 KB Output is correct
35 Correct 28 ms 6232 KB Output is correct
36 Correct 22 ms 5056 KB Output is correct
37 Correct 20 ms 4740 KB Output is correct
38 Correct 29 ms 6348 KB Output is correct
39 Correct 27 ms 6428 KB Output is correct
40 Correct 30 ms 5708 KB Output is correct
41 Correct 29 ms 6372 KB Output is correct
42 Correct 37 ms 6272 KB Output is correct
43 Correct 28 ms 5684 KB Output is correct
44 Correct 31 ms 6352 KB Output is correct
45 Correct 30 ms 6456 KB Output is correct
46 Correct 29 ms 6356 KB Output is correct
47 Correct 35 ms 6312 KB Output is correct
48 Correct 36 ms 6368 KB Output is correct
49 Correct 36 ms 6348 KB Output is correct
50 Correct 543 ms 80644 KB Output is correct
51 Correct 344 ms 49464 KB Output is correct
52 Correct 302 ms 44068 KB Output is correct
53 Correct 238 ms 38904 KB Output is correct
54 Correct 131 ms 21556 KB Output is correct
55 Correct 591 ms 89540 KB Output is correct
56 Correct 512 ms 77880 KB Output is correct
57 Correct 513 ms 71980 KB Output is correct
58 Correct 658 ms 100596 KB Output is correct
59 Correct 675 ms 97412 KB Output is correct
60 Correct 411 ms 60552 KB Output is correct
61 Correct 618 ms 92560 KB Output is correct
62 Correct 124 ms 20784 KB Output is correct
63 Correct 698 ms 100664 KB Output is correct
64 Correct 721 ms 100632 KB Output is correct
65 Correct 616 ms 88736 KB Output is correct
66 Correct 644 ms 100832 KB Output is correct
67 Correct 693 ms 100720 KB Output is correct
68 Correct 679 ms 100684 KB Output is correct
69 Correct 752 ms 100652 KB Output is correct
70 Correct 628 ms 88816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 20 ms 4604 KB Output is correct
27 Correct 13 ms 2900 KB Output is correct
28 Correct 6 ms 1364 KB Output is correct
29 Correct 3 ms 956 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 25 ms 5444 KB Output is correct
32 Correct 25 ms 4376 KB Output is correct
33 Correct 19 ms 4088 KB Output is correct
34 Correct 31 ms 6348 KB Output is correct
35 Correct 28 ms 6232 KB Output is correct
36 Correct 22 ms 5056 KB Output is correct
37 Correct 20 ms 4740 KB Output is correct
38 Correct 29 ms 6348 KB Output is correct
39 Correct 27 ms 6428 KB Output is correct
40 Correct 30 ms 5708 KB Output is correct
41 Correct 29 ms 6372 KB Output is correct
42 Correct 37 ms 6272 KB Output is correct
43 Correct 28 ms 5684 KB Output is correct
44 Correct 31 ms 6352 KB Output is correct
45 Correct 30 ms 6456 KB Output is correct
46 Correct 29 ms 6356 KB Output is correct
47 Correct 35 ms 6312 KB Output is correct
48 Correct 36 ms 6368 KB Output is correct
49 Correct 36 ms 6348 KB Output is correct
50 Correct 543 ms 80644 KB Output is correct
51 Correct 344 ms 49464 KB Output is correct
52 Correct 302 ms 44068 KB Output is correct
53 Correct 238 ms 38904 KB Output is correct
54 Correct 131 ms 21556 KB Output is correct
55 Correct 591 ms 89540 KB Output is correct
56 Correct 512 ms 77880 KB Output is correct
57 Correct 513 ms 71980 KB Output is correct
58 Correct 658 ms 100596 KB Output is correct
59 Correct 675 ms 97412 KB Output is correct
60 Correct 411 ms 60552 KB Output is correct
61 Correct 618 ms 92560 KB Output is correct
62 Correct 124 ms 20784 KB Output is correct
63 Correct 698 ms 100664 KB Output is correct
64 Correct 721 ms 100632 KB Output is correct
65 Correct 616 ms 88736 KB Output is correct
66 Correct 644 ms 100832 KB Output is correct
67 Correct 693 ms 100720 KB Output is correct
68 Correct 679 ms 100684 KB Output is correct
69 Correct 752 ms 100652 KB Output is correct
70 Correct 628 ms 88816 KB Output is correct
71 Runtime error 111 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 20 ms 4604 KB Output is correct
27 Correct 13 ms 2900 KB Output is correct
28 Correct 6 ms 1364 KB Output is correct
29 Correct 3 ms 956 KB Output is correct
30 Correct 2 ms 724 KB Output is correct
31 Correct 25 ms 5444 KB Output is correct
32 Correct 25 ms 4376 KB Output is correct
33 Correct 19 ms 4088 KB Output is correct
34 Correct 31 ms 6348 KB Output is correct
35 Correct 28 ms 6232 KB Output is correct
36 Correct 22 ms 5056 KB Output is correct
37 Correct 20 ms 4740 KB Output is correct
38 Correct 29 ms 6348 KB Output is correct
39 Correct 27 ms 6428 KB Output is correct
40 Correct 30 ms 5708 KB Output is correct
41 Correct 29 ms 6372 KB Output is correct
42 Correct 37 ms 6272 KB Output is correct
43 Correct 28 ms 5684 KB Output is correct
44 Correct 31 ms 6352 KB Output is correct
45 Correct 30 ms 6456 KB Output is correct
46 Correct 29 ms 6356 KB Output is correct
47 Correct 35 ms 6312 KB Output is correct
48 Correct 36 ms 6368 KB Output is correct
49 Correct 36 ms 6348 KB Output is correct
50 Correct 543 ms 80644 KB Output is correct
51 Correct 344 ms 49464 KB Output is correct
52 Correct 302 ms 44068 KB Output is correct
53 Correct 238 ms 38904 KB Output is correct
54 Correct 131 ms 21556 KB Output is correct
55 Correct 591 ms 89540 KB Output is correct
56 Correct 512 ms 77880 KB Output is correct
57 Correct 513 ms 71980 KB Output is correct
58 Correct 658 ms 100596 KB Output is correct
59 Correct 675 ms 97412 KB Output is correct
60 Correct 411 ms 60552 KB Output is correct
61 Correct 618 ms 92560 KB Output is correct
62 Correct 124 ms 20784 KB Output is correct
63 Correct 698 ms 100664 KB Output is correct
64 Correct 721 ms 100632 KB Output is correct
65 Correct 616 ms 88736 KB Output is correct
66 Correct 644 ms 100832 KB Output is correct
67 Correct 693 ms 100720 KB Output is correct
68 Correct 679 ms 100684 KB Output is correct
69 Correct 752 ms 100652 KB Output is correct
70 Correct 628 ms 88816 KB Output is correct
71 Runtime error 111 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -