답안 #711470

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
711470 2023-03-17T03:21:02 Z ToroTN Toys (CEOI18_toy) C++14
100 / 100
1638 ms 4400 KB
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
//solution by PP.....
int n;
set<int> s;
void solve(int num,int sum,int pre)
{
    ///printf("%d %d %d\n",num,sum,pre);
    if(num==1)
    {
        s.insert(sum);
        return;
    }
    for(int i=1;i*i<=num;i++)
    {
        if(num%i==0)
        {
            if(i>=pre&&i!=1)
            {
                solve(num/i,sum+i-1,i);
            }
            if(num/i>=pre&&i*i!=num)
            {
                solve(i,sum+num/i-1,num/i);
            }
        }
    }
}
int main()
{
    cin >> n;
    solve(n,0,0);
    printf("%d\n",s.size());
    for(auto it=s.begin();it!=s.end();it++)printf("%d ",*it);
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:34:14: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   34 |     printf("%d\n",s.size());
      |             ~^    ~~~~~~~~
      |              |          |
      |              int        std::set<int>::size_type {aka long unsigned int}
      |             %ld
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 236 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 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 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 236 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 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 1 ms 212 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 296 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 300 KB Output is correct
34 Correct 1 ms 296 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 300 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 236 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 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 1 ms 212 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 296 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 300 KB Output is correct
34 Correct 1 ms 296 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 300 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 300 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Correct 2 ms 340 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 300 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 300 KB Output is correct
67 Correct 1 ms 304 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 236 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 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 1 ms 212 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 296 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 300 KB Output is correct
34 Correct 1 ms 296 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 300 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 300 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Correct 2 ms 340 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 300 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 300 KB Output is correct
67 Correct 1 ms 304 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 132 ms 1348 KB Output is correct
72 Correct 89 ms 1144 KB Output is correct
73 Correct 133 ms 1220 KB Output is correct
74 Correct 62 ms 1004 KB Output is correct
75 Correct 77 ms 992 KB Output is correct
76 Correct 258 ms 1564 KB Output is correct
77 Correct 281 ms 1524 KB Output is correct
78 Correct 195 ms 1560 KB Output is correct
79 Correct 199 ms 1356 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 340 KB Output is correct
83 Correct 23 ms 600 KB Output is correct
84 Correct 24 ms 716 KB Output is correct
85 Correct 7 ms 428 KB Output is correct
86 Correct 1 ms 212 KB Output is correct
87 Correct 29 ms 684 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 1 ms 296 KB Output is correct
91 Correct 9 ms 508 KB Output is correct
92 Correct 31 ms 848 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 300 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 236 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 0 ms 300 KB Output is correct
9 Correct 1 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 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 296 KB Output is correct
15 Correct 1 ms 300 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 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 1 ms 212 KB Output is correct
26 Correct 1 ms 300 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 296 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 212 KB Output is correct
32 Correct 1 ms 212 KB Output is correct
33 Correct 1 ms 300 KB Output is correct
34 Correct 1 ms 296 KB Output is correct
35 Correct 1 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 212 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 1 ms 296 KB Output is correct
40 Correct 1 ms 212 KB Output is correct
41 Correct 1 ms 304 KB Output is correct
42 Correct 1 ms 212 KB Output is correct
43 Correct 1 ms 212 KB Output is correct
44 Correct 1 ms 212 KB Output is correct
45 Correct 1 ms 340 KB Output is correct
46 Correct 1 ms 212 KB Output is correct
47 Correct 1 ms 212 KB Output is correct
48 Correct 1 ms 300 KB Output is correct
49 Correct 1 ms 212 KB Output is correct
50 Correct 1 ms 300 KB Output is correct
51 Correct 1 ms 212 KB Output is correct
52 Correct 1 ms 212 KB Output is correct
53 Correct 1 ms 212 KB Output is correct
54 Correct 1 ms 212 KB Output is correct
55 Correct 2 ms 340 KB Output is correct
56 Correct 2 ms 340 KB Output is correct
57 Correct 1 ms 212 KB Output is correct
58 Correct 1 ms 212 KB Output is correct
59 Correct 1 ms 212 KB Output is correct
60 Correct 1 ms 212 KB Output is correct
61 Correct 1 ms 212 KB Output is correct
62 Correct 1 ms 300 KB Output is correct
63 Correct 1 ms 212 KB Output is correct
64 Correct 1 ms 212 KB Output is correct
65 Correct 1 ms 212 KB Output is correct
66 Correct 1 ms 300 KB Output is correct
67 Correct 1 ms 304 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 212 KB Output is correct
70 Correct 1 ms 212 KB Output is correct
71 Correct 132 ms 1348 KB Output is correct
72 Correct 89 ms 1144 KB Output is correct
73 Correct 133 ms 1220 KB Output is correct
74 Correct 62 ms 1004 KB Output is correct
75 Correct 77 ms 992 KB Output is correct
76 Correct 258 ms 1564 KB Output is correct
77 Correct 281 ms 1524 KB Output is correct
78 Correct 195 ms 1560 KB Output is correct
79 Correct 199 ms 1356 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 340 KB Output is correct
83 Correct 23 ms 600 KB Output is correct
84 Correct 24 ms 716 KB Output is correct
85 Correct 7 ms 428 KB Output is correct
86 Correct 1 ms 212 KB Output is correct
87 Correct 29 ms 684 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 1 ms 212 KB Output is correct
90 Correct 1 ms 296 KB Output is correct
91 Correct 9 ms 508 KB Output is correct
92 Correct 31 ms 848 KB Output is correct
93 Correct 1193 ms 3960 KB Output is correct
94 Correct 507 ms 3248 KB Output is correct
95 Correct 650 ms 3308 KB Output is correct
96 Correct 546 ms 2876 KB Output is correct
97 Correct 549 ms 2672 KB Output is correct
98 Correct 1491 ms 4400 KB Output is correct
99 Correct 1638 ms 4396 KB Output is correct
100 Correct 1410 ms 4204 KB Output is correct
101 Correct 1619 ms 4168 KB Output is correct
102 Correct 1382 ms 3764 KB Output is correct
103 Correct 809 ms 3800 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 5 ms 340 KB Output is correct
107 Correct 112 ms 1084 KB Output is correct
108 Correct 251 ms 1832 KB Output is correct
109 Correct 23 ms 576 KB Output is correct
110 Correct 2 ms 224 KB Output is correct
111 Correct 120 ms 1280 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 296 KB Output is correct
114 Correct 8 ms 340 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 20 ms 464 KB Output is correct
117 Correct 169 ms 2208 KB Output is correct