답안 #533818

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533818 2022-03-07T11:14:25 Z groshi Toys (CEOI18_toy) C++17
100 / 100
771 ms 4424 KB
#include<iostream>
#include<vector>
#include<algorithm>
#include<set>
using namespace std;
vector<int> Q;
set<int> wynik;
set<int>::iterator it;
void rozklad(int n)
{
    for(int i=1;i*i<=n;i++)
        if(n%i==0)
        {
            if(i*i==n)
                Q.push_back(i);
            else{
                Q.push_back(i);
                Q.push_back(n/i);
            }
        }
    sort(Q.begin(),Q.end());
}
void oblicz(int n,int gdzie,int suma)
{
    if(n==1)
    {
        wynik.insert(suma);
        return;
    }
    for(int i=gdzie;i>0;i--)
    {
        if(n%Q[i]==0)
            oblicz(n/Q[i],i,suma+Q[i]-1);
    }
}
int main()
{
    cin.tie(0);
    cout.tie(0);
    ios_base::sync_with_stdio(0);
    int n;
    cin>>n;
    rozklad(n);
    oblicz(n,Q.size()-1,0);
    cout<<wynik.size()<<"\n";
    for(it=wynik.begin();it!=wynik.end();it++)
        cout<<*it<<" ";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 208 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 320 KB Output is correct
38 Correct 0 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 1 ms 208 KB Output is correct
41 Correct 1 ms 208 KB Output is correct
42 Correct 1 ms 208 KB Output is correct
43 Correct 1 ms 208 KB Output is correct
44 Correct 1 ms 208 KB Output is correct
45 Correct 0 ms 208 KB Output is correct
46 Correct 1 ms 208 KB Output is correct
47 Correct 1 ms 316 KB Output is correct
48 Correct 1 ms 208 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 208 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 320 KB Output is correct
38 Correct 0 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 1 ms 208 KB Output is correct
41 Correct 1 ms 208 KB Output is correct
42 Correct 1 ms 208 KB Output is correct
43 Correct 1 ms 208 KB Output is correct
44 Correct 1 ms 208 KB Output is correct
45 Correct 0 ms 208 KB Output is correct
46 Correct 1 ms 208 KB Output is correct
47 Correct 1 ms 316 KB Output is correct
48 Correct 1 ms 208 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 336 KB Output is correct
53 Correct 1 ms 336 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 320 KB Output is correct
58 Correct 1 ms 208 KB Output is correct
59 Correct 0 ms 320 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 1 ms 316 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 312 KB Output is correct
67 Correct 1 ms 208 KB Output is correct
68 Correct 0 ms 208 KB Output is correct
69 Correct 1 ms 208 KB Output is correct
70 Correct 1 ms 208 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 208 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 320 KB Output is correct
38 Correct 0 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 1 ms 208 KB Output is correct
41 Correct 1 ms 208 KB Output is correct
42 Correct 1 ms 208 KB Output is correct
43 Correct 1 ms 208 KB Output is correct
44 Correct 1 ms 208 KB Output is correct
45 Correct 0 ms 208 KB Output is correct
46 Correct 1 ms 208 KB Output is correct
47 Correct 1 ms 316 KB Output is correct
48 Correct 1 ms 208 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 336 KB Output is correct
53 Correct 1 ms 336 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 320 KB Output is correct
58 Correct 1 ms 208 KB Output is correct
59 Correct 0 ms 320 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 1 ms 316 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 312 KB Output is correct
67 Correct 1 ms 208 KB Output is correct
68 Correct 0 ms 208 KB Output is correct
69 Correct 1 ms 208 KB Output is correct
70 Correct 1 ms 208 KB Output is correct
71 Correct 76 ms 1352 KB Output is correct
72 Correct 50 ms 1176 KB Output is correct
73 Correct 77 ms 1144 KB Output is correct
74 Correct 38 ms 1020 KB Output is correct
75 Correct 47 ms 1064 KB Output is correct
76 Correct 147 ms 1804 KB Output is correct
77 Correct 146 ms 1516 KB Output is correct
78 Correct 105 ms 1408 KB Output is correct
79 Correct 104 ms 1432 KB Output is correct
80 Correct 0 ms 208 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 11 ms 604 KB Output is correct
84 Correct 12 ms 700 KB Output is correct
85 Correct 2 ms 464 KB Output is correct
86 Correct 1 ms 208 KB Output is correct
87 Correct 12 ms 732 KB Output is correct
88 Correct 1 ms 208 KB Output is correct
89 Correct 1 ms 316 KB Output is correct
90 Correct 1 ms 208 KB Output is correct
91 Correct 4 ms 592 KB Output is correct
92 Correct 17 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 208 KB Output is correct
2 Correct 0 ms 312 KB Output is correct
3 Correct 1 ms 208 KB Output is correct
4 Correct 1 ms 208 KB Output is correct
5 Correct 1 ms 208 KB Output is correct
6 Correct 1 ms 208 KB Output is correct
7 Correct 1 ms 208 KB Output is correct
8 Correct 1 ms 208 KB Output is correct
9 Correct 0 ms 208 KB Output is correct
10 Correct 1 ms 208 KB Output is correct
11 Correct 1 ms 208 KB Output is correct
12 Correct 0 ms 208 KB Output is correct
13 Correct 0 ms 208 KB Output is correct
14 Correct 0 ms 208 KB Output is correct
15 Correct 1 ms 336 KB Output is correct
16 Correct 1 ms 208 KB Output is correct
17 Correct 1 ms 316 KB Output is correct
18 Correct 1 ms 208 KB Output is correct
19 Correct 0 ms 208 KB Output is correct
20 Correct 1 ms 324 KB Output is correct
21 Correct 1 ms 208 KB Output is correct
22 Correct 0 ms 208 KB Output is correct
23 Correct 0 ms 208 KB Output is correct
24 Correct 1 ms 208 KB Output is correct
25 Correct 1 ms 208 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 208 KB Output is correct
28 Correct 1 ms 208 KB Output is correct
29 Correct 1 ms 208 KB Output is correct
30 Correct 1 ms 316 KB Output is correct
31 Correct 1 ms 208 KB Output is correct
32 Correct 1 ms 208 KB Output is correct
33 Correct 1 ms 208 KB Output is correct
34 Correct 1 ms 208 KB Output is correct
35 Correct 1 ms 316 KB Output is correct
36 Correct 1 ms 316 KB Output is correct
37 Correct 1 ms 320 KB Output is correct
38 Correct 0 ms 208 KB Output is correct
39 Correct 1 ms 208 KB Output is correct
40 Correct 1 ms 208 KB Output is correct
41 Correct 1 ms 208 KB Output is correct
42 Correct 1 ms 208 KB Output is correct
43 Correct 1 ms 208 KB Output is correct
44 Correct 1 ms 208 KB Output is correct
45 Correct 0 ms 208 KB Output is correct
46 Correct 1 ms 208 KB Output is correct
47 Correct 1 ms 316 KB Output is correct
48 Correct 1 ms 208 KB Output is correct
49 Correct 1 ms 312 KB Output is correct
50 Correct 1 ms 336 KB Output is correct
51 Correct 1 ms 336 KB Output is correct
52 Correct 1 ms 336 KB Output is correct
53 Correct 1 ms 336 KB Output is correct
54 Correct 1 ms 336 KB Output is correct
55 Correct 1 ms 336 KB Output is correct
56 Correct 1 ms 336 KB Output is correct
57 Correct 1 ms 320 KB Output is correct
58 Correct 1 ms 208 KB Output is correct
59 Correct 0 ms 320 KB Output is correct
60 Correct 1 ms 208 KB Output is correct
61 Correct 1 ms 336 KB Output is correct
62 Correct 1 ms 208 KB Output is correct
63 Correct 1 ms 316 KB Output is correct
64 Correct 1 ms 208 KB Output is correct
65 Correct 1 ms 336 KB Output is correct
66 Correct 1 ms 312 KB Output is correct
67 Correct 1 ms 208 KB Output is correct
68 Correct 0 ms 208 KB Output is correct
69 Correct 1 ms 208 KB Output is correct
70 Correct 1 ms 208 KB Output is correct
71 Correct 76 ms 1352 KB Output is correct
72 Correct 50 ms 1176 KB Output is correct
73 Correct 77 ms 1144 KB Output is correct
74 Correct 38 ms 1020 KB Output is correct
75 Correct 47 ms 1064 KB Output is correct
76 Correct 147 ms 1804 KB Output is correct
77 Correct 146 ms 1516 KB Output is correct
78 Correct 105 ms 1408 KB Output is correct
79 Correct 104 ms 1432 KB Output is correct
80 Correct 0 ms 208 KB Output is correct
81 Correct 1 ms 208 KB Output is correct
82 Correct 1 ms 336 KB Output is correct
83 Correct 11 ms 604 KB Output is correct
84 Correct 12 ms 700 KB Output is correct
85 Correct 2 ms 464 KB Output is correct
86 Correct 1 ms 208 KB Output is correct
87 Correct 12 ms 732 KB Output is correct
88 Correct 1 ms 208 KB Output is correct
89 Correct 1 ms 316 KB Output is correct
90 Correct 1 ms 208 KB Output is correct
91 Correct 4 ms 592 KB Output is correct
92 Correct 17 ms 848 KB Output is correct
93 Correct 551 ms 3988 KB Output is correct
94 Correct 251 ms 3196 KB Output is correct
95 Correct 331 ms 3256 KB Output is correct
96 Correct 284 ms 2888 KB Output is correct
97 Correct 254 ms 2592 KB Output is correct
98 Correct 636 ms 4420 KB Output is correct
99 Correct 771 ms 4424 KB Output is correct
100 Correct 622 ms 4280 KB Output is correct
101 Correct 711 ms 4036 KB Output is correct
102 Correct 591 ms 3744 KB Output is correct
103 Correct 346 ms 3516 KB Output is correct
104 Correct 1 ms 208 KB Output is correct
105 Correct 1 ms 316 KB Output is correct
106 Correct 2 ms 336 KB Output is correct
107 Correct 38 ms 1096 KB Output is correct
108 Correct 93 ms 1804 KB Output is correct
109 Correct 6 ms 720 KB Output is correct
110 Correct 1 ms 208 KB Output is correct
111 Correct 36 ms 1352 KB Output is correct
112 Correct 1 ms 208 KB Output is correct
113 Correct 1 ms 208 KB Output is correct
114 Correct 2 ms 444 KB Output is correct
115 Correct 1 ms 208 KB Output is correct
116 Correct 3 ms 572 KB Output is correct
117 Correct 79 ms 2164 KB Output is correct