답안 #96392

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
96392 2019-02-09T09:15:41 Z easrui Toys (CEOI18_toy) C++14
100 / 100
823 ms 7092 KB
#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5;
int N,tmp,fac[MAX],num[MAX],selA[MAX],selB[MAX],posA,posB,cnt,res,ans,A,B,C;
vector<int> pows[MAX];
set<int> S;
bool isP[MAX];

void act(int cur, int val, int sum)
{
    if(val>=cur) S.insert(sum+cur-1);
    if(cur==1) return;
    for(int i=2; i<=min(val,cur/i); i++){
        if(cur%i) continue;
        if(i<=val) act(cur/i,i,sum+i-1);
        if(cur/i<=val) act(i,cur/i,sum+cur/i-1);
    }
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin >> N;
    act(N,N,0);
    cout << S.size() << '\n';
    for(auto it : S) cout << it << ' ';
    /*tmp = N;
    for(int i=0; i<MAX; i++) isP[i] = true;
    for(int i=2; i*i<=N; i++){
        if(isP[i]){
            for(int j=2; j*j*i*i<=N; j++) isP[j*i] = false;
            if(tmp%i==0) fac[++cnt] = i;
            while(tmp%i==0){
                num[cnt]++;
                tmp /= i;
            }
        }
    }
    if(tmp!=1){
        fac[++cnt] = tmp;
        num[cnt]++;
    }
    for(int i=1; i<=cnt; i++){
        pows[i].push_back(1);
        for(int j=1; j<=num[i]; j++){
            pows[i].push_back(pows[i][j-1]*fac[i]);
        }
    }
    A = B = 1;
    S.insert(A+B+(N/A/B));
    while(1){
        for(posB= 1; posB <= cnt; posB++){
            if(selB[posB]<num[posB]-selA[posB]){
                selB[posB]++;
                B *= fac[posB];
                break;
            }
            B /= pows[posB][num[posB]-selA[posB]];
            selB[posB] = 0;
        }
        if(posB>cnt) break;
        S.insert(A+B+(N/A/B));
    }
    while(1){
        for(posA = 1; posA <= cnt; posA++){
            if(selA[posA]<num[posA]){
                selA[posA]++;
                A *= fac[posA];
                break;
            }
            A /= pows[posA][num[posA]];
            selA[posA] = 0;
        }
        if(posA>cnt) break;
        B = 1;
        S.insert(A+B+(N/A/B));
        for(int pos = 1; pos <= cnt ; pos++) selB[pos] = 0;
        while(1){
            for(posB= 1; posB <= cnt; posB++){
                if(selB[posB]<num[posB]-selA[posB]){
                    selB[posB]++;
                    B *= fac[posB];
                    break;
                }
                B /= pows[posB][num[posB]-selA[posB]];
                selB[posB] = 0;
            }
            if(posB>cnt) break;
            S.insert(A+B+(N/A/B));
        }
    }
    cout << S.size() << '\n';
    for(auto it : S) cout << (it-3) << ' ';*/
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 4 ms 2680 KB Output is correct
5 Correct 3 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 3 ms 2680 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Correct 4 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 4 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 3 ms 2684 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 4 ms 2740 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2684 KB Output is correct
25 Correct 4 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 4 ms 2680 KB Output is correct
5 Correct 3 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 3 ms 2680 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Correct 4 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 4 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 3 ms 2684 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 4 ms 2740 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2684 KB Output is correct
25 Correct 4 ms 2680 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
27 Correct 4 ms 2680 KB Output is correct
28 Correct 5 ms 2680 KB Output is correct
29 Correct 5 ms 2680 KB Output is correct
30 Correct 4 ms 2808 KB Output is correct
31 Correct 4 ms 2680 KB Output is correct
32 Correct 4 ms 2680 KB Output is correct
33 Correct 4 ms 2680 KB Output is correct
34 Correct 4 ms 2680 KB Output is correct
35 Correct 5 ms 2680 KB Output is correct
36 Correct 4 ms 2680 KB Output is correct
37 Correct 4 ms 2680 KB Output is correct
38 Correct 4 ms 2680 KB Output is correct
39 Correct 4 ms 2680 KB Output is correct
40 Correct 4 ms 2680 KB Output is correct
41 Correct 4 ms 2680 KB Output is correct
42 Correct 4 ms 2680 KB Output is correct
43 Correct 4 ms 2680 KB Output is correct
44 Correct 4 ms 2680 KB Output is correct
45 Correct 5 ms 2680 KB Output is correct
46 Correct 4 ms 2684 KB Output is correct
47 Correct 4 ms 2680 KB Output is correct
48 Correct 4 ms 2680 KB Output is correct
49 Correct 4 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 4 ms 2680 KB Output is correct
5 Correct 3 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 3 ms 2680 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Correct 4 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 4 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 3 ms 2684 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 4 ms 2740 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2684 KB Output is correct
25 Correct 4 ms 2680 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
27 Correct 4 ms 2680 KB Output is correct
28 Correct 5 ms 2680 KB Output is correct
29 Correct 5 ms 2680 KB Output is correct
30 Correct 4 ms 2808 KB Output is correct
31 Correct 4 ms 2680 KB Output is correct
32 Correct 4 ms 2680 KB Output is correct
33 Correct 4 ms 2680 KB Output is correct
34 Correct 4 ms 2680 KB Output is correct
35 Correct 5 ms 2680 KB Output is correct
36 Correct 4 ms 2680 KB Output is correct
37 Correct 4 ms 2680 KB Output is correct
38 Correct 4 ms 2680 KB Output is correct
39 Correct 4 ms 2680 KB Output is correct
40 Correct 4 ms 2680 KB Output is correct
41 Correct 4 ms 2680 KB Output is correct
42 Correct 4 ms 2680 KB Output is correct
43 Correct 4 ms 2680 KB Output is correct
44 Correct 4 ms 2680 KB Output is correct
45 Correct 5 ms 2680 KB Output is correct
46 Correct 4 ms 2684 KB Output is correct
47 Correct 4 ms 2680 KB Output is correct
48 Correct 4 ms 2680 KB Output is correct
49 Correct 4 ms 2680 KB Output is correct
50 Correct 6 ms 2680 KB Output is correct
51 Correct 4 ms 2680 KB Output is correct
52 Correct 5 ms 2808 KB Output is correct
53 Correct 4 ms 2808 KB Output is correct
54 Correct 4 ms 2680 KB Output is correct
55 Correct 5 ms 2808 KB Output is correct
56 Correct 5 ms 2684 KB Output is correct
57 Correct 5 ms 2808 KB Output is correct
58 Correct 4 ms 2684 KB Output is correct
59 Correct 4 ms 2680 KB Output is correct
60 Correct 4 ms 2680 KB Output is correct
61 Correct 4 ms 2680 KB Output is correct
62 Correct 5 ms 2808 KB Output is correct
63 Correct 4 ms 2680 KB Output is correct
64 Correct 4 ms 2680 KB Output is correct
65 Correct 4 ms 2680 KB Output is correct
66 Correct 4 ms 2680 KB Output is correct
67 Correct 3 ms 2680 KB Output is correct
68 Correct 5 ms 2680 KB Output is correct
69 Correct 4 ms 2680 KB Output is correct
70 Correct 4 ms 2680 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 4 ms 2680 KB Output is correct
5 Correct 3 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 3 ms 2680 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Correct 4 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 4 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 3 ms 2684 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 4 ms 2740 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2684 KB Output is correct
25 Correct 4 ms 2680 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
27 Correct 4 ms 2680 KB Output is correct
28 Correct 5 ms 2680 KB Output is correct
29 Correct 5 ms 2680 KB Output is correct
30 Correct 4 ms 2808 KB Output is correct
31 Correct 4 ms 2680 KB Output is correct
32 Correct 4 ms 2680 KB Output is correct
33 Correct 4 ms 2680 KB Output is correct
34 Correct 4 ms 2680 KB Output is correct
35 Correct 5 ms 2680 KB Output is correct
36 Correct 4 ms 2680 KB Output is correct
37 Correct 4 ms 2680 KB Output is correct
38 Correct 4 ms 2680 KB Output is correct
39 Correct 4 ms 2680 KB Output is correct
40 Correct 4 ms 2680 KB Output is correct
41 Correct 4 ms 2680 KB Output is correct
42 Correct 4 ms 2680 KB Output is correct
43 Correct 4 ms 2680 KB Output is correct
44 Correct 4 ms 2680 KB Output is correct
45 Correct 5 ms 2680 KB Output is correct
46 Correct 4 ms 2684 KB Output is correct
47 Correct 4 ms 2680 KB Output is correct
48 Correct 4 ms 2680 KB Output is correct
49 Correct 4 ms 2680 KB Output is correct
50 Correct 6 ms 2680 KB Output is correct
51 Correct 4 ms 2680 KB Output is correct
52 Correct 5 ms 2808 KB Output is correct
53 Correct 4 ms 2808 KB Output is correct
54 Correct 4 ms 2680 KB Output is correct
55 Correct 5 ms 2808 KB Output is correct
56 Correct 5 ms 2684 KB Output is correct
57 Correct 5 ms 2808 KB Output is correct
58 Correct 4 ms 2684 KB Output is correct
59 Correct 4 ms 2680 KB Output is correct
60 Correct 4 ms 2680 KB Output is correct
61 Correct 4 ms 2680 KB Output is correct
62 Correct 5 ms 2808 KB Output is correct
63 Correct 4 ms 2680 KB Output is correct
64 Correct 4 ms 2680 KB Output is correct
65 Correct 4 ms 2680 KB Output is correct
66 Correct 4 ms 2680 KB Output is correct
67 Correct 3 ms 2680 KB Output is correct
68 Correct 5 ms 2680 KB Output is correct
69 Correct 4 ms 2680 KB Output is correct
70 Correct 4 ms 2680 KB Output is correct
71 Correct 76 ms 3824 KB Output is correct
72 Correct 52 ms 3636 KB Output is correct
73 Correct 87 ms 3704 KB Output is correct
74 Correct 39 ms 3448 KB Output is correct
75 Correct 51 ms 3448 KB Output is correct
76 Correct 151 ms 4088 KB Output is correct
77 Correct 180 ms 3960 KB Output is correct
78 Correct 119 ms 3944 KB Output is correct
79 Correct 120 ms 3888 KB Output is correct
80 Correct 4 ms 2680 KB Output is correct
81 Correct 5 ms 2680 KB Output is correct
82 Correct 5 ms 2808 KB Output is correct
83 Correct 18 ms 3064 KB Output is correct
84 Correct 19 ms 3064 KB Output is correct
85 Correct 8 ms 2808 KB Output is correct
86 Correct 4 ms 2680 KB Output is correct
87 Correct 18 ms 3192 KB Output is correct
88 Correct 5 ms 2680 KB Output is correct
89 Correct 4 ms 2680 KB Output is correct
90 Correct 5 ms 2680 KB Output is correct
91 Correct 7 ms 2936 KB Output is correct
92 Correct 22 ms 3332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 2680 KB Output is correct
2 Correct 4 ms 2680 KB Output is correct
3 Correct 4 ms 2680 KB Output is correct
4 Correct 4 ms 2680 KB Output is correct
5 Correct 3 ms 2680 KB Output is correct
6 Correct 4 ms 2680 KB Output is correct
7 Correct 4 ms 2680 KB Output is correct
8 Correct 4 ms 2680 KB Output is correct
9 Correct 3 ms 2680 KB Output is correct
10 Correct 4 ms 2680 KB Output is correct
11 Correct 4 ms 2680 KB Output is correct
12 Correct 4 ms 2808 KB Output is correct
13 Correct 4 ms 2680 KB Output is correct
14 Correct 4 ms 2680 KB Output is correct
15 Correct 4 ms 2680 KB Output is correct
16 Correct 4 ms 2680 KB Output is correct
17 Correct 4 ms 2680 KB Output is correct
18 Correct 5 ms 2680 KB Output is correct
19 Correct 4 ms 2680 KB Output is correct
20 Correct 3 ms 2684 KB Output is correct
21 Correct 5 ms 2680 KB Output is correct
22 Correct 4 ms 2740 KB Output is correct
23 Correct 4 ms 2680 KB Output is correct
24 Correct 4 ms 2684 KB Output is correct
25 Correct 4 ms 2680 KB Output is correct
26 Correct 4 ms 2680 KB Output is correct
27 Correct 4 ms 2680 KB Output is correct
28 Correct 5 ms 2680 KB Output is correct
29 Correct 5 ms 2680 KB Output is correct
30 Correct 4 ms 2808 KB Output is correct
31 Correct 4 ms 2680 KB Output is correct
32 Correct 4 ms 2680 KB Output is correct
33 Correct 4 ms 2680 KB Output is correct
34 Correct 4 ms 2680 KB Output is correct
35 Correct 5 ms 2680 KB Output is correct
36 Correct 4 ms 2680 KB Output is correct
37 Correct 4 ms 2680 KB Output is correct
38 Correct 4 ms 2680 KB Output is correct
39 Correct 4 ms 2680 KB Output is correct
40 Correct 4 ms 2680 KB Output is correct
41 Correct 4 ms 2680 KB Output is correct
42 Correct 4 ms 2680 KB Output is correct
43 Correct 4 ms 2680 KB Output is correct
44 Correct 4 ms 2680 KB Output is correct
45 Correct 5 ms 2680 KB Output is correct
46 Correct 4 ms 2684 KB Output is correct
47 Correct 4 ms 2680 KB Output is correct
48 Correct 4 ms 2680 KB Output is correct
49 Correct 4 ms 2680 KB Output is correct
50 Correct 6 ms 2680 KB Output is correct
51 Correct 4 ms 2680 KB Output is correct
52 Correct 5 ms 2808 KB Output is correct
53 Correct 4 ms 2808 KB Output is correct
54 Correct 4 ms 2680 KB Output is correct
55 Correct 5 ms 2808 KB Output is correct
56 Correct 5 ms 2684 KB Output is correct
57 Correct 5 ms 2808 KB Output is correct
58 Correct 4 ms 2684 KB Output is correct
59 Correct 4 ms 2680 KB Output is correct
60 Correct 4 ms 2680 KB Output is correct
61 Correct 4 ms 2680 KB Output is correct
62 Correct 5 ms 2808 KB Output is correct
63 Correct 4 ms 2680 KB Output is correct
64 Correct 4 ms 2680 KB Output is correct
65 Correct 4 ms 2680 KB Output is correct
66 Correct 4 ms 2680 KB Output is correct
67 Correct 3 ms 2680 KB Output is correct
68 Correct 5 ms 2680 KB Output is correct
69 Correct 4 ms 2680 KB Output is correct
70 Correct 4 ms 2680 KB Output is correct
71 Correct 76 ms 3824 KB Output is correct
72 Correct 52 ms 3636 KB Output is correct
73 Correct 87 ms 3704 KB Output is correct
74 Correct 39 ms 3448 KB Output is correct
75 Correct 51 ms 3448 KB Output is correct
76 Correct 151 ms 4088 KB Output is correct
77 Correct 180 ms 3960 KB Output is correct
78 Correct 119 ms 3944 KB Output is correct
79 Correct 120 ms 3888 KB Output is correct
80 Correct 4 ms 2680 KB Output is correct
81 Correct 5 ms 2680 KB Output is correct
82 Correct 5 ms 2808 KB Output is correct
83 Correct 18 ms 3064 KB Output is correct
84 Correct 19 ms 3064 KB Output is correct
85 Correct 8 ms 2808 KB Output is correct
86 Correct 4 ms 2680 KB Output is correct
87 Correct 18 ms 3192 KB Output is correct
88 Correct 5 ms 2680 KB Output is correct
89 Correct 4 ms 2680 KB Output is correct
90 Correct 5 ms 2680 KB Output is correct
91 Correct 7 ms 2936 KB Output is correct
92 Correct 22 ms 3332 KB Output is correct
93 Correct 547 ms 6520 KB Output is correct
94 Correct 233 ms 5704 KB Output is correct
95 Correct 313 ms 5644 KB Output is correct
96 Correct 273 ms 5240 KB Output is correct
97 Correct 257 ms 4956 KB Output is correct
98 Correct 667 ms 7092 KB Output is correct
99 Correct 823 ms 6948 KB Output is correct
100 Correct 647 ms 6776 KB Output is correct
101 Correct 814 ms 6528 KB Output is correct
102 Correct 660 ms 6136 KB Output is correct
103 Correct 355 ms 6012 KB Output is correct
104 Correct 5 ms 2680 KB Output is correct
105 Correct 5 ms 2680 KB Output is correct
106 Correct 6 ms 2808 KB Output is correct
107 Correct 55 ms 3576 KB Output is correct
108 Correct 123 ms 4192 KB Output is correct
109 Correct 11 ms 3064 KB Output is correct
110 Correct 5 ms 2680 KB Output is correct
111 Correct 46 ms 3704 KB Output is correct
112 Correct 4 ms 2680 KB Output is correct
113 Correct 4 ms 2684 KB Output is correct
114 Correct 6 ms 2808 KB Output is correct
115 Correct 4 ms 2680 KB Output is correct
116 Correct 7 ms 2936 KB Output is correct
117 Correct 88 ms 4700 KB Output is correct