#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define sz(x) (int)x.size()
int n;
set<int> sum[100005], ans;
map<pair<int,int>, bool> mp;
void find(int nw, int add)
{
if(nw < 100005)
{
for(auto _: sum[nw])
ans.insert(add + _);
return ;
}
if(mp[{nw, add}]) return ;
mp[{nw,add}] = true;
find(1, add + nw - 1);
for(int j = 2; j * j <= nw; j++)
{
if(n % j == 0)
{
int a = j;
int b = nw / j;
find(a, add + b - 1);
find(b, add + a - 1);
}
}
}
int main()
{
sum[1].insert(0);
for(int i = 2; i < 100005; i++)
{
for(int j = 1; j * j <= i; j++)
{
if(i % j == 0)
{
int a = j;
int b = i / j;
for(auto _: sum[b])
{
sum[i].insert(a - 1 + _);
}
for(auto _: sum[a])
{
sum[i].insert(b - 1 + _);
}
}
}
}
scanf("%d",&n);
find(n, 0);
printf("%d\n",sz(ans));
for(auto _: ans)
printf("%d ",_);
printf("\n");
return 0;
}
Compilation message
toy.cpp: In function 'int main()':
toy.cpp:56:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
56 | scanf("%d",&n);
| ~~~~~^~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
657 ms |
100608 KB |
Output is correct |
2 |
Correct |
670 ms |
100576 KB |
Output is correct |
3 |
Correct |
658 ms |
100628 KB |
Output is correct |
4 |
Correct |
676 ms |
100636 KB |
Output is correct |
5 |
Correct |
655 ms |
100588 KB |
Output is correct |
6 |
Correct |
650 ms |
100564 KB |
Output is correct |
7 |
Correct |
651 ms |
100600 KB |
Output is correct |
8 |
Correct |
663 ms |
100556 KB |
Output is correct |
9 |
Correct |
654 ms |
100692 KB |
Output is correct |
10 |
Correct |
670 ms |
100516 KB |
Output is correct |
11 |
Correct |
664 ms |
100544 KB |
Output is correct |
12 |
Correct |
678 ms |
100696 KB |
Output is correct |
13 |
Correct |
680 ms |
100632 KB |
Output is correct |
14 |
Correct |
647 ms |
100576 KB |
Output is correct |
15 |
Correct |
660 ms |
100628 KB |
Output is correct |
16 |
Correct |
663 ms |
100636 KB |
Output is correct |
17 |
Correct |
696 ms |
100540 KB |
Output is correct |
18 |
Correct |
656 ms |
100668 KB |
Output is correct |
19 |
Correct |
650 ms |
100560 KB |
Output is correct |
20 |
Correct |
699 ms |
100540 KB |
Output is correct |
21 |
Correct |
650 ms |
100632 KB |
Output is correct |
22 |
Correct |
667 ms |
100504 KB |
Output is correct |
23 |
Correct |
689 ms |
100568 KB |
Output is correct |
24 |
Correct |
700 ms |
100608 KB |
Output is correct |
25 |
Correct |
686 ms |
100776 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
657 ms |
100608 KB |
Output is correct |
2 |
Correct |
670 ms |
100576 KB |
Output is correct |
3 |
Correct |
658 ms |
100628 KB |
Output is correct |
4 |
Correct |
676 ms |
100636 KB |
Output is correct |
5 |
Correct |
655 ms |
100588 KB |
Output is correct |
6 |
Correct |
650 ms |
100564 KB |
Output is correct |
7 |
Correct |
651 ms |
100600 KB |
Output is correct |
8 |
Correct |
663 ms |
100556 KB |
Output is correct |
9 |
Correct |
654 ms |
100692 KB |
Output is correct |
10 |
Correct |
670 ms |
100516 KB |
Output is correct |
11 |
Correct |
664 ms |
100544 KB |
Output is correct |
12 |
Correct |
678 ms |
100696 KB |
Output is correct |
13 |
Correct |
680 ms |
100632 KB |
Output is correct |
14 |
Correct |
647 ms |
100576 KB |
Output is correct |
15 |
Correct |
660 ms |
100628 KB |
Output is correct |
16 |
Correct |
663 ms |
100636 KB |
Output is correct |
17 |
Correct |
696 ms |
100540 KB |
Output is correct |
18 |
Correct |
656 ms |
100668 KB |
Output is correct |
19 |
Correct |
650 ms |
100560 KB |
Output is correct |
20 |
Correct |
699 ms |
100540 KB |
Output is correct |
21 |
Correct |
650 ms |
100632 KB |
Output is correct |
22 |
Correct |
667 ms |
100504 KB |
Output is correct |
23 |
Correct |
689 ms |
100568 KB |
Output is correct |
24 |
Correct |
700 ms |
100608 KB |
Output is correct |
25 |
Correct |
686 ms |
100776 KB |
Output is correct |
26 |
Correct |
667 ms |
100620 KB |
Output is correct |
27 |
Correct |
640 ms |
100636 KB |
Output is correct |
28 |
Correct |
660 ms |
100664 KB |
Output is correct |
29 |
Correct |
711 ms |
100608 KB |
Output is correct |
30 |
Correct |
663 ms |
100796 KB |
Output is correct |
31 |
Correct |
671 ms |
100764 KB |
Output is correct |
32 |
Correct |
641 ms |
100588 KB |
Output is correct |
33 |
Correct |
680 ms |
100640 KB |
Output is correct |
34 |
Correct |
643 ms |
100692 KB |
Output is correct |
35 |
Correct |
654 ms |
100540 KB |
Output is correct |
36 |
Correct |
662 ms |
100584 KB |
Output is correct |
37 |
Correct |
682 ms |
100528 KB |
Output is correct |
38 |
Correct |
676 ms |
100568 KB |
Output is correct |
39 |
Correct |
656 ms |
100580 KB |
Output is correct |
40 |
Correct |
669 ms |
100604 KB |
Output is correct |
41 |
Correct |
655 ms |
100596 KB |
Output is correct |
42 |
Correct |
674 ms |
100632 KB |
Output is correct |
43 |
Correct |
698 ms |
100636 KB |
Output is correct |
44 |
Correct |
699 ms |
100668 KB |
Output is correct |
45 |
Correct |
644 ms |
100644 KB |
Output is correct |
46 |
Correct |
651 ms |
100528 KB |
Output is correct |
47 |
Correct |
690 ms |
100532 KB |
Output is correct |
48 |
Correct |
665 ms |
100516 KB |
Output is correct |
49 |
Correct |
670 ms |
100624 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
657 ms |
100608 KB |
Output is correct |
2 |
Correct |
670 ms |
100576 KB |
Output is correct |
3 |
Correct |
658 ms |
100628 KB |
Output is correct |
4 |
Correct |
676 ms |
100636 KB |
Output is correct |
5 |
Correct |
655 ms |
100588 KB |
Output is correct |
6 |
Correct |
650 ms |
100564 KB |
Output is correct |
7 |
Correct |
651 ms |
100600 KB |
Output is correct |
8 |
Correct |
663 ms |
100556 KB |
Output is correct |
9 |
Correct |
654 ms |
100692 KB |
Output is correct |
10 |
Correct |
670 ms |
100516 KB |
Output is correct |
11 |
Correct |
664 ms |
100544 KB |
Output is correct |
12 |
Correct |
678 ms |
100696 KB |
Output is correct |
13 |
Correct |
680 ms |
100632 KB |
Output is correct |
14 |
Correct |
647 ms |
100576 KB |
Output is correct |
15 |
Correct |
660 ms |
100628 KB |
Output is correct |
16 |
Correct |
663 ms |
100636 KB |
Output is correct |
17 |
Correct |
696 ms |
100540 KB |
Output is correct |
18 |
Correct |
656 ms |
100668 KB |
Output is correct |
19 |
Correct |
650 ms |
100560 KB |
Output is correct |
20 |
Correct |
699 ms |
100540 KB |
Output is correct |
21 |
Correct |
650 ms |
100632 KB |
Output is correct |
22 |
Correct |
667 ms |
100504 KB |
Output is correct |
23 |
Correct |
689 ms |
100568 KB |
Output is correct |
24 |
Correct |
700 ms |
100608 KB |
Output is correct |
25 |
Correct |
686 ms |
100776 KB |
Output is correct |
26 |
Correct |
667 ms |
100620 KB |
Output is correct |
27 |
Correct |
640 ms |
100636 KB |
Output is correct |
28 |
Correct |
660 ms |
100664 KB |
Output is correct |
29 |
Correct |
711 ms |
100608 KB |
Output is correct |
30 |
Correct |
663 ms |
100796 KB |
Output is correct |
31 |
Correct |
671 ms |
100764 KB |
Output is correct |
32 |
Correct |
641 ms |
100588 KB |
Output is correct |
33 |
Correct |
680 ms |
100640 KB |
Output is correct |
34 |
Correct |
643 ms |
100692 KB |
Output is correct |
35 |
Correct |
654 ms |
100540 KB |
Output is correct |
36 |
Correct |
662 ms |
100584 KB |
Output is correct |
37 |
Correct |
682 ms |
100528 KB |
Output is correct |
38 |
Correct |
676 ms |
100568 KB |
Output is correct |
39 |
Correct |
656 ms |
100580 KB |
Output is correct |
40 |
Correct |
669 ms |
100604 KB |
Output is correct |
41 |
Correct |
655 ms |
100596 KB |
Output is correct |
42 |
Correct |
674 ms |
100632 KB |
Output is correct |
43 |
Correct |
698 ms |
100636 KB |
Output is correct |
44 |
Correct |
699 ms |
100668 KB |
Output is correct |
45 |
Correct |
644 ms |
100644 KB |
Output is correct |
46 |
Correct |
651 ms |
100528 KB |
Output is correct |
47 |
Correct |
690 ms |
100532 KB |
Output is correct |
48 |
Correct |
665 ms |
100516 KB |
Output is correct |
49 |
Correct |
670 ms |
100624 KB |
Output is correct |
50 |
Correct |
640 ms |
100768 KB |
Output is correct |
51 |
Correct |
658 ms |
100540 KB |
Output is correct |
52 |
Correct |
683 ms |
100588 KB |
Output is correct |
53 |
Correct |
685 ms |
100536 KB |
Output is correct |
54 |
Correct |
664 ms |
100660 KB |
Output is correct |
55 |
Correct |
678 ms |
100664 KB |
Output is correct |
56 |
Correct |
674 ms |
100688 KB |
Output is correct |
57 |
Correct |
670 ms |
100768 KB |
Output is correct |
58 |
Correct |
668 ms |
100592 KB |
Output is correct |
59 |
Correct |
650 ms |
100568 KB |
Output is correct |
60 |
Correct |
679 ms |
100540 KB |
Output is correct |
61 |
Correct |
644 ms |
100660 KB |
Output is correct |
62 |
Correct |
685 ms |
100644 KB |
Output is correct |
63 |
Correct |
661 ms |
100572 KB |
Output is correct |
64 |
Correct |
642 ms |
100628 KB |
Output is correct |
65 |
Correct |
666 ms |
100684 KB |
Output is correct |
66 |
Correct |
658 ms |
100596 KB |
Output is correct |
67 |
Correct |
666 ms |
100580 KB |
Output is correct |
68 |
Correct |
677 ms |
100584 KB |
Output is correct |
69 |
Correct |
669 ms |
100684 KB |
Output is correct |
70 |
Correct |
654 ms |
100672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
657 ms |
100608 KB |
Output is correct |
2 |
Correct |
670 ms |
100576 KB |
Output is correct |
3 |
Correct |
658 ms |
100628 KB |
Output is correct |
4 |
Correct |
676 ms |
100636 KB |
Output is correct |
5 |
Correct |
655 ms |
100588 KB |
Output is correct |
6 |
Correct |
650 ms |
100564 KB |
Output is correct |
7 |
Correct |
651 ms |
100600 KB |
Output is correct |
8 |
Correct |
663 ms |
100556 KB |
Output is correct |
9 |
Correct |
654 ms |
100692 KB |
Output is correct |
10 |
Correct |
670 ms |
100516 KB |
Output is correct |
11 |
Correct |
664 ms |
100544 KB |
Output is correct |
12 |
Correct |
678 ms |
100696 KB |
Output is correct |
13 |
Correct |
680 ms |
100632 KB |
Output is correct |
14 |
Correct |
647 ms |
100576 KB |
Output is correct |
15 |
Correct |
660 ms |
100628 KB |
Output is correct |
16 |
Correct |
663 ms |
100636 KB |
Output is correct |
17 |
Correct |
696 ms |
100540 KB |
Output is correct |
18 |
Correct |
656 ms |
100668 KB |
Output is correct |
19 |
Correct |
650 ms |
100560 KB |
Output is correct |
20 |
Correct |
699 ms |
100540 KB |
Output is correct |
21 |
Correct |
650 ms |
100632 KB |
Output is correct |
22 |
Correct |
667 ms |
100504 KB |
Output is correct |
23 |
Correct |
689 ms |
100568 KB |
Output is correct |
24 |
Correct |
700 ms |
100608 KB |
Output is correct |
25 |
Correct |
686 ms |
100776 KB |
Output is correct |
26 |
Correct |
667 ms |
100620 KB |
Output is correct |
27 |
Correct |
640 ms |
100636 KB |
Output is correct |
28 |
Correct |
660 ms |
100664 KB |
Output is correct |
29 |
Correct |
711 ms |
100608 KB |
Output is correct |
30 |
Correct |
663 ms |
100796 KB |
Output is correct |
31 |
Correct |
671 ms |
100764 KB |
Output is correct |
32 |
Correct |
641 ms |
100588 KB |
Output is correct |
33 |
Correct |
680 ms |
100640 KB |
Output is correct |
34 |
Correct |
643 ms |
100692 KB |
Output is correct |
35 |
Correct |
654 ms |
100540 KB |
Output is correct |
36 |
Correct |
662 ms |
100584 KB |
Output is correct |
37 |
Correct |
682 ms |
100528 KB |
Output is correct |
38 |
Correct |
676 ms |
100568 KB |
Output is correct |
39 |
Correct |
656 ms |
100580 KB |
Output is correct |
40 |
Correct |
669 ms |
100604 KB |
Output is correct |
41 |
Correct |
655 ms |
100596 KB |
Output is correct |
42 |
Correct |
674 ms |
100632 KB |
Output is correct |
43 |
Correct |
698 ms |
100636 KB |
Output is correct |
44 |
Correct |
699 ms |
100668 KB |
Output is correct |
45 |
Correct |
644 ms |
100644 KB |
Output is correct |
46 |
Correct |
651 ms |
100528 KB |
Output is correct |
47 |
Correct |
690 ms |
100532 KB |
Output is correct |
48 |
Correct |
665 ms |
100516 KB |
Output is correct |
49 |
Correct |
670 ms |
100624 KB |
Output is correct |
50 |
Correct |
640 ms |
100768 KB |
Output is correct |
51 |
Correct |
658 ms |
100540 KB |
Output is correct |
52 |
Correct |
683 ms |
100588 KB |
Output is correct |
53 |
Correct |
685 ms |
100536 KB |
Output is correct |
54 |
Correct |
664 ms |
100660 KB |
Output is correct |
55 |
Correct |
678 ms |
100664 KB |
Output is correct |
56 |
Correct |
674 ms |
100688 KB |
Output is correct |
57 |
Correct |
670 ms |
100768 KB |
Output is correct |
58 |
Correct |
668 ms |
100592 KB |
Output is correct |
59 |
Correct |
650 ms |
100568 KB |
Output is correct |
60 |
Correct |
679 ms |
100540 KB |
Output is correct |
61 |
Correct |
644 ms |
100660 KB |
Output is correct |
62 |
Correct |
685 ms |
100644 KB |
Output is correct |
63 |
Correct |
661 ms |
100572 KB |
Output is correct |
64 |
Correct |
642 ms |
100628 KB |
Output is correct |
65 |
Correct |
666 ms |
100684 KB |
Output is correct |
66 |
Correct |
658 ms |
100596 KB |
Output is correct |
67 |
Correct |
666 ms |
100580 KB |
Output is correct |
68 |
Correct |
677 ms |
100584 KB |
Output is correct |
69 |
Correct |
669 ms |
100684 KB |
Output is correct |
70 |
Correct |
654 ms |
100672 KB |
Output is correct |
71 |
Incorrect |
1694 ms |
102376 KB |
Output isn't correct |
72 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
657 ms |
100608 KB |
Output is correct |
2 |
Correct |
670 ms |
100576 KB |
Output is correct |
3 |
Correct |
658 ms |
100628 KB |
Output is correct |
4 |
Correct |
676 ms |
100636 KB |
Output is correct |
5 |
Correct |
655 ms |
100588 KB |
Output is correct |
6 |
Correct |
650 ms |
100564 KB |
Output is correct |
7 |
Correct |
651 ms |
100600 KB |
Output is correct |
8 |
Correct |
663 ms |
100556 KB |
Output is correct |
9 |
Correct |
654 ms |
100692 KB |
Output is correct |
10 |
Correct |
670 ms |
100516 KB |
Output is correct |
11 |
Correct |
664 ms |
100544 KB |
Output is correct |
12 |
Correct |
678 ms |
100696 KB |
Output is correct |
13 |
Correct |
680 ms |
100632 KB |
Output is correct |
14 |
Correct |
647 ms |
100576 KB |
Output is correct |
15 |
Correct |
660 ms |
100628 KB |
Output is correct |
16 |
Correct |
663 ms |
100636 KB |
Output is correct |
17 |
Correct |
696 ms |
100540 KB |
Output is correct |
18 |
Correct |
656 ms |
100668 KB |
Output is correct |
19 |
Correct |
650 ms |
100560 KB |
Output is correct |
20 |
Correct |
699 ms |
100540 KB |
Output is correct |
21 |
Correct |
650 ms |
100632 KB |
Output is correct |
22 |
Correct |
667 ms |
100504 KB |
Output is correct |
23 |
Correct |
689 ms |
100568 KB |
Output is correct |
24 |
Correct |
700 ms |
100608 KB |
Output is correct |
25 |
Correct |
686 ms |
100776 KB |
Output is correct |
26 |
Correct |
667 ms |
100620 KB |
Output is correct |
27 |
Correct |
640 ms |
100636 KB |
Output is correct |
28 |
Correct |
660 ms |
100664 KB |
Output is correct |
29 |
Correct |
711 ms |
100608 KB |
Output is correct |
30 |
Correct |
663 ms |
100796 KB |
Output is correct |
31 |
Correct |
671 ms |
100764 KB |
Output is correct |
32 |
Correct |
641 ms |
100588 KB |
Output is correct |
33 |
Correct |
680 ms |
100640 KB |
Output is correct |
34 |
Correct |
643 ms |
100692 KB |
Output is correct |
35 |
Correct |
654 ms |
100540 KB |
Output is correct |
36 |
Correct |
662 ms |
100584 KB |
Output is correct |
37 |
Correct |
682 ms |
100528 KB |
Output is correct |
38 |
Correct |
676 ms |
100568 KB |
Output is correct |
39 |
Correct |
656 ms |
100580 KB |
Output is correct |
40 |
Correct |
669 ms |
100604 KB |
Output is correct |
41 |
Correct |
655 ms |
100596 KB |
Output is correct |
42 |
Correct |
674 ms |
100632 KB |
Output is correct |
43 |
Correct |
698 ms |
100636 KB |
Output is correct |
44 |
Correct |
699 ms |
100668 KB |
Output is correct |
45 |
Correct |
644 ms |
100644 KB |
Output is correct |
46 |
Correct |
651 ms |
100528 KB |
Output is correct |
47 |
Correct |
690 ms |
100532 KB |
Output is correct |
48 |
Correct |
665 ms |
100516 KB |
Output is correct |
49 |
Correct |
670 ms |
100624 KB |
Output is correct |
50 |
Correct |
640 ms |
100768 KB |
Output is correct |
51 |
Correct |
658 ms |
100540 KB |
Output is correct |
52 |
Correct |
683 ms |
100588 KB |
Output is correct |
53 |
Correct |
685 ms |
100536 KB |
Output is correct |
54 |
Correct |
664 ms |
100660 KB |
Output is correct |
55 |
Correct |
678 ms |
100664 KB |
Output is correct |
56 |
Correct |
674 ms |
100688 KB |
Output is correct |
57 |
Correct |
670 ms |
100768 KB |
Output is correct |
58 |
Correct |
668 ms |
100592 KB |
Output is correct |
59 |
Correct |
650 ms |
100568 KB |
Output is correct |
60 |
Correct |
679 ms |
100540 KB |
Output is correct |
61 |
Correct |
644 ms |
100660 KB |
Output is correct |
62 |
Correct |
685 ms |
100644 KB |
Output is correct |
63 |
Correct |
661 ms |
100572 KB |
Output is correct |
64 |
Correct |
642 ms |
100628 KB |
Output is correct |
65 |
Correct |
666 ms |
100684 KB |
Output is correct |
66 |
Correct |
658 ms |
100596 KB |
Output is correct |
67 |
Correct |
666 ms |
100580 KB |
Output is correct |
68 |
Correct |
677 ms |
100584 KB |
Output is correct |
69 |
Correct |
669 ms |
100684 KB |
Output is correct |
70 |
Correct |
654 ms |
100672 KB |
Output is correct |
71 |
Incorrect |
1694 ms |
102376 KB |
Output isn't correct |
72 |
Halted |
0 ms |
0 KB |
- |