Submission #585009

# Submission time Handle Problem Language Result Execution time Memory
585009 2022-06-28T08:36:25 Z hibiki Toys (CEOI18_toy) C++11
59 / 100
5000 ms 101984 KB
#include<bits/stdc++.h>
using namespace std;

#define pb push_back
#define sz(x) (int)x.size()

int n;
set<int> sum[100005], ans;

void find(int nw, int add)
{
    if(nw < 100005)
    {
        for(auto _: sum[nw])
            ans.insert(add + _);
        return ;
    }
    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:53:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   53 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 629 ms 100752 KB Output is correct
2 Correct 629 ms 100572 KB Output is correct
3 Correct 631 ms 100628 KB Output is correct
4 Correct 634 ms 100672 KB Output is correct
5 Correct 638 ms 100628 KB Output is correct
6 Correct 624 ms 100552 KB Output is correct
7 Correct 648 ms 100740 KB Output is correct
8 Correct 629 ms 100648 KB Output is correct
9 Correct 625 ms 100632 KB Output is correct
10 Correct 637 ms 100676 KB Output is correct
11 Correct 638 ms 100580 KB Output is correct
12 Correct 630 ms 100748 KB Output is correct
13 Correct 634 ms 100628 KB Output is correct
14 Correct 646 ms 100632 KB Output is correct
15 Correct 631 ms 100628 KB Output is correct
16 Correct 634 ms 100684 KB Output is correct
17 Correct 632 ms 100584 KB Output is correct
18 Correct 637 ms 100624 KB Output is correct
19 Correct 635 ms 100588 KB Output is correct
20 Correct 650 ms 100640 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 638 ms 100676 KB Output is correct
23 Correct 639 ms 100564 KB Output is correct
24 Correct 642 ms 100632 KB Output is correct
25 Correct 642 ms 100704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 629 ms 100752 KB Output is correct
2 Correct 629 ms 100572 KB Output is correct
3 Correct 631 ms 100628 KB Output is correct
4 Correct 634 ms 100672 KB Output is correct
5 Correct 638 ms 100628 KB Output is correct
6 Correct 624 ms 100552 KB Output is correct
7 Correct 648 ms 100740 KB Output is correct
8 Correct 629 ms 100648 KB Output is correct
9 Correct 625 ms 100632 KB Output is correct
10 Correct 637 ms 100676 KB Output is correct
11 Correct 638 ms 100580 KB Output is correct
12 Correct 630 ms 100748 KB Output is correct
13 Correct 634 ms 100628 KB Output is correct
14 Correct 646 ms 100632 KB Output is correct
15 Correct 631 ms 100628 KB Output is correct
16 Correct 634 ms 100684 KB Output is correct
17 Correct 632 ms 100584 KB Output is correct
18 Correct 637 ms 100624 KB Output is correct
19 Correct 635 ms 100588 KB Output is correct
20 Correct 650 ms 100640 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 638 ms 100676 KB Output is correct
23 Correct 639 ms 100564 KB Output is correct
24 Correct 642 ms 100632 KB Output is correct
25 Correct 642 ms 100704 KB Output is correct
26 Correct 637 ms 100620 KB Output is correct
27 Correct 623 ms 100560 KB Output is correct
28 Correct 651 ms 100548 KB Output is correct
29 Correct 641 ms 100516 KB Output is correct
30 Correct 631 ms 100784 KB Output is correct
31 Correct 630 ms 100548 KB Output is correct
32 Correct 625 ms 100576 KB Output is correct
33 Correct 648 ms 100524 KB Output is correct
34 Correct 624 ms 100564 KB Output is correct
35 Correct 634 ms 100664 KB Output is correct
36 Correct 632 ms 100616 KB Output is correct
37 Correct 635 ms 100744 KB Output is correct
38 Correct 626 ms 100632 KB Output is correct
39 Correct 630 ms 100632 KB Output is correct
40 Correct 652 ms 100724 KB Output is correct
41 Correct 626 ms 100620 KB Output is correct
42 Correct 636 ms 100592 KB Output is correct
43 Correct 629 ms 100740 KB Output is correct
44 Correct 621 ms 100524 KB Output is correct
45 Correct 629 ms 100560 KB Output is correct
46 Correct 638 ms 100552 KB Output is correct
47 Correct 618 ms 100556 KB Output is correct
48 Correct 630 ms 100824 KB Output is correct
49 Correct 625 ms 100636 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 629 ms 100752 KB Output is correct
2 Correct 629 ms 100572 KB Output is correct
3 Correct 631 ms 100628 KB Output is correct
4 Correct 634 ms 100672 KB Output is correct
5 Correct 638 ms 100628 KB Output is correct
6 Correct 624 ms 100552 KB Output is correct
7 Correct 648 ms 100740 KB Output is correct
8 Correct 629 ms 100648 KB Output is correct
9 Correct 625 ms 100632 KB Output is correct
10 Correct 637 ms 100676 KB Output is correct
11 Correct 638 ms 100580 KB Output is correct
12 Correct 630 ms 100748 KB Output is correct
13 Correct 634 ms 100628 KB Output is correct
14 Correct 646 ms 100632 KB Output is correct
15 Correct 631 ms 100628 KB Output is correct
16 Correct 634 ms 100684 KB Output is correct
17 Correct 632 ms 100584 KB Output is correct
18 Correct 637 ms 100624 KB Output is correct
19 Correct 635 ms 100588 KB Output is correct
20 Correct 650 ms 100640 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 638 ms 100676 KB Output is correct
23 Correct 639 ms 100564 KB Output is correct
24 Correct 642 ms 100632 KB Output is correct
25 Correct 642 ms 100704 KB Output is correct
26 Correct 637 ms 100620 KB Output is correct
27 Correct 623 ms 100560 KB Output is correct
28 Correct 651 ms 100548 KB Output is correct
29 Correct 641 ms 100516 KB Output is correct
30 Correct 631 ms 100784 KB Output is correct
31 Correct 630 ms 100548 KB Output is correct
32 Correct 625 ms 100576 KB Output is correct
33 Correct 648 ms 100524 KB Output is correct
34 Correct 624 ms 100564 KB Output is correct
35 Correct 634 ms 100664 KB Output is correct
36 Correct 632 ms 100616 KB Output is correct
37 Correct 635 ms 100744 KB Output is correct
38 Correct 626 ms 100632 KB Output is correct
39 Correct 630 ms 100632 KB Output is correct
40 Correct 652 ms 100724 KB Output is correct
41 Correct 626 ms 100620 KB Output is correct
42 Correct 636 ms 100592 KB Output is correct
43 Correct 629 ms 100740 KB Output is correct
44 Correct 621 ms 100524 KB Output is correct
45 Correct 629 ms 100560 KB Output is correct
46 Correct 638 ms 100552 KB Output is correct
47 Correct 618 ms 100556 KB Output is correct
48 Correct 630 ms 100824 KB Output is correct
49 Correct 625 ms 100636 KB Output is correct
50 Correct 648 ms 100576 KB Output is correct
51 Correct 627 ms 100680 KB Output is correct
52 Correct 625 ms 100756 KB Output is correct
53 Correct 627 ms 100660 KB Output is correct
54 Correct 634 ms 100704 KB Output is correct
55 Correct 635 ms 100764 KB Output is correct
56 Correct 640 ms 100748 KB Output is correct
57 Correct 628 ms 100564 KB Output is correct
58 Correct 636 ms 100584 KB Output is correct
59 Correct 646 ms 100760 KB Output is correct
60 Correct 636 ms 100644 KB Output is correct
61 Correct 629 ms 100940 KB Output is correct
62 Correct 636 ms 100572 KB Output is correct
63 Correct 622 ms 100528 KB Output is correct
64 Correct 636 ms 100636 KB Output is correct
65 Correct 639 ms 100764 KB Output is correct
66 Correct 634 ms 100684 KB Output is correct
67 Correct 637 ms 100596 KB Output is correct
68 Correct 640 ms 100556 KB Output is correct
69 Correct 645 ms 100540 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 629 ms 100752 KB Output is correct
2 Correct 629 ms 100572 KB Output is correct
3 Correct 631 ms 100628 KB Output is correct
4 Correct 634 ms 100672 KB Output is correct
5 Correct 638 ms 100628 KB Output is correct
6 Correct 624 ms 100552 KB Output is correct
7 Correct 648 ms 100740 KB Output is correct
8 Correct 629 ms 100648 KB Output is correct
9 Correct 625 ms 100632 KB Output is correct
10 Correct 637 ms 100676 KB Output is correct
11 Correct 638 ms 100580 KB Output is correct
12 Correct 630 ms 100748 KB Output is correct
13 Correct 634 ms 100628 KB Output is correct
14 Correct 646 ms 100632 KB Output is correct
15 Correct 631 ms 100628 KB Output is correct
16 Correct 634 ms 100684 KB Output is correct
17 Correct 632 ms 100584 KB Output is correct
18 Correct 637 ms 100624 KB Output is correct
19 Correct 635 ms 100588 KB Output is correct
20 Correct 650 ms 100640 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 638 ms 100676 KB Output is correct
23 Correct 639 ms 100564 KB Output is correct
24 Correct 642 ms 100632 KB Output is correct
25 Correct 642 ms 100704 KB Output is correct
26 Correct 637 ms 100620 KB Output is correct
27 Correct 623 ms 100560 KB Output is correct
28 Correct 651 ms 100548 KB Output is correct
29 Correct 641 ms 100516 KB Output is correct
30 Correct 631 ms 100784 KB Output is correct
31 Correct 630 ms 100548 KB Output is correct
32 Correct 625 ms 100576 KB Output is correct
33 Correct 648 ms 100524 KB Output is correct
34 Correct 624 ms 100564 KB Output is correct
35 Correct 634 ms 100664 KB Output is correct
36 Correct 632 ms 100616 KB Output is correct
37 Correct 635 ms 100744 KB Output is correct
38 Correct 626 ms 100632 KB Output is correct
39 Correct 630 ms 100632 KB Output is correct
40 Correct 652 ms 100724 KB Output is correct
41 Correct 626 ms 100620 KB Output is correct
42 Correct 636 ms 100592 KB Output is correct
43 Correct 629 ms 100740 KB Output is correct
44 Correct 621 ms 100524 KB Output is correct
45 Correct 629 ms 100560 KB Output is correct
46 Correct 638 ms 100552 KB Output is correct
47 Correct 618 ms 100556 KB Output is correct
48 Correct 630 ms 100824 KB Output is correct
49 Correct 625 ms 100636 KB Output is correct
50 Correct 648 ms 100576 KB Output is correct
51 Correct 627 ms 100680 KB Output is correct
52 Correct 625 ms 100756 KB Output is correct
53 Correct 627 ms 100660 KB Output is correct
54 Correct 634 ms 100704 KB Output is correct
55 Correct 635 ms 100764 KB Output is correct
56 Correct 640 ms 100748 KB Output is correct
57 Correct 628 ms 100564 KB Output is correct
58 Correct 636 ms 100584 KB Output is correct
59 Correct 646 ms 100760 KB Output is correct
60 Correct 636 ms 100644 KB Output is correct
61 Correct 629 ms 100940 KB Output is correct
62 Correct 636 ms 100572 KB Output is correct
63 Correct 622 ms 100528 KB Output is correct
64 Correct 636 ms 100636 KB Output is correct
65 Correct 639 ms 100764 KB Output is correct
66 Correct 634 ms 100684 KB Output is correct
67 Correct 637 ms 100596 KB Output is correct
68 Correct 640 ms 100556 KB Output is correct
69 Correct 645 ms 100540 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
71 Execution timed out 5039 ms 101984 KB Time limit exceeded
72 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 629 ms 100752 KB Output is correct
2 Correct 629 ms 100572 KB Output is correct
3 Correct 631 ms 100628 KB Output is correct
4 Correct 634 ms 100672 KB Output is correct
5 Correct 638 ms 100628 KB Output is correct
6 Correct 624 ms 100552 KB Output is correct
7 Correct 648 ms 100740 KB Output is correct
8 Correct 629 ms 100648 KB Output is correct
9 Correct 625 ms 100632 KB Output is correct
10 Correct 637 ms 100676 KB Output is correct
11 Correct 638 ms 100580 KB Output is correct
12 Correct 630 ms 100748 KB Output is correct
13 Correct 634 ms 100628 KB Output is correct
14 Correct 646 ms 100632 KB Output is correct
15 Correct 631 ms 100628 KB Output is correct
16 Correct 634 ms 100684 KB Output is correct
17 Correct 632 ms 100584 KB Output is correct
18 Correct 637 ms 100624 KB Output is correct
19 Correct 635 ms 100588 KB Output is correct
20 Correct 650 ms 100640 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 638 ms 100676 KB Output is correct
23 Correct 639 ms 100564 KB Output is correct
24 Correct 642 ms 100632 KB Output is correct
25 Correct 642 ms 100704 KB Output is correct
26 Correct 637 ms 100620 KB Output is correct
27 Correct 623 ms 100560 KB Output is correct
28 Correct 651 ms 100548 KB Output is correct
29 Correct 641 ms 100516 KB Output is correct
30 Correct 631 ms 100784 KB Output is correct
31 Correct 630 ms 100548 KB Output is correct
32 Correct 625 ms 100576 KB Output is correct
33 Correct 648 ms 100524 KB Output is correct
34 Correct 624 ms 100564 KB Output is correct
35 Correct 634 ms 100664 KB Output is correct
36 Correct 632 ms 100616 KB Output is correct
37 Correct 635 ms 100744 KB Output is correct
38 Correct 626 ms 100632 KB Output is correct
39 Correct 630 ms 100632 KB Output is correct
40 Correct 652 ms 100724 KB Output is correct
41 Correct 626 ms 100620 KB Output is correct
42 Correct 636 ms 100592 KB Output is correct
43 Correct 629 ms 100740 KB Output is correct
44 Correct 621 ms 100524 KB Output is correct
45 Correct 629 ms 100560 KB Output is correct
46 Correct 638 ms 100552 KB Output is correct
47 Correct 618 ms 100556 KB Output is correct
48 Correct 630 ms 100824 KB Output is correct
49 Correct 625 ms 100636 KB Output is correct
50 Correct 648 ms 100576 KB Output is correct
51 Correct 627 ms 100680 KB Output is correct
52 Correct 625 ms 100756 KB Output is correct
53 Correct 627 ms 100660 KB Output is correct
54 Correct 634 ms 100704 KB Output is correct
55 Correct 635 ms 100764 KB Output is correct
56 Correct 640 ms 100748 KB Output is correct
57 Correct 628 ms 100564 KB Output is correct
58 Correct 636 ms 100584 KB Output is correct
59 Correct 646 ms 100760 KB Output is correct
60 Correct 636 ms 100644 KB Output is correct
61 Correct 629 ms 100940 KB Output is correct
62 Correct 636 ms 100572 KB Output is correct
63 Correct 622 ms 100528 KB Output is correct
64 Correct 636 ms 100636 KB Output is correct
65 Correct 639 ms 100764 KB Output is correct
66 Correct 634 ms 100684 KB Output is correct
67 Correct 637 ms 100596 KB Output is correct
68 Correct 640 ms 100556 KB Output is correct
69 Correct 645 ms 100540 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
71 Execution timed out 5039 ms 101984 KB Time limit exceeded
72 Halted 0 ms 0 KB -