답안 #584989

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
584989 2022-06-28T08:13:29 Z hibiki Toys (CEOI18_toy) C++11
59 / 100
768 ms 203852 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;

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 + _);
                }
            }
        }
    }
    // for(int i = 1; i < 10; i++)
    // {
    //     printf("--%d--\n",i);
    //     for(auto val: sum[i])
    //         printf("%d ",val);
    //     printf("\n");
    // }
    scanf("%d",&n);
    for(int j = 1; j * j <= n; j++)
    {
        if(n % j == 0)
        {
            int a = j;
            int b = n / j;
            for(auto _: sum[b])
            {
                ans.insert(a - 1 + _);
            }
            for(auto _: sum[a])
            {
                ans.insert(b - 1 + _);
            }
        }
    }
    printf("%d\n",sz(ans));
    for(auto _: ans)
        printf("%d ",_);
    printf("\n");
    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   39 |     scanf("%d",&n);
      |     ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 100812 KB Output is correct
2 Correct 646 ms 100744 KB Output is correct
3 Correct 623 ms 100628 KB Output is correct
4 Correct 625 ms 100600 KB Output is correct
5 Correct 629 ms 100572 KB Output is correct
6 Correct 634 ms 100632 KB Output is correct
7 Correct 623 ms 100632 KB Output is correct
8 Correct 634 ms 100560 KB Output is correct
9 Correct 634 ms 100524 KB Output is correct
10 Correct 638 ms 100624 KB Output is correct
11 Correct 618 ms 100756 KB Output is correct
12 Correct 628 ms 100604 KB Output is correct
13 Correct 638 ms 100580 KB Output is correct
14 Correct 648 ms 100716 KB Output is correct
15 Correct 622 ms 100628 KB Output is correct
16 Correct 632 ms 100624 KB Output is correct
17 Correct 636 ms 100652 KB Output is correct
18 Correct 631 ms 100704 KB Output is correct
19 Correct 634 ms 100516 KB Output is correct
20 Correct 628 ms 100644 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 622 ms 100556 KB Output is correct
23 Correct 639 ms 100592 KB Output is correct
24 Correct 629 ms 100716 KB Output is correct
25 Correct 667 ms 100608 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 100812 KB Output is correct
2 Correct 646 ms 100744 KB Output is correct
3 Correct 623 ms 100628 KB Output is correct
4 Correct 625 ms 100600 KB Output is correct
5 Correct 629 ms 100572 KB Output is correct
6 Correct 634 ms 100632 KB Output is correct
7 Correct 623 ms 100632 KB Output is correct
8 Correct 634 ms 100560 KB Output is correct
9 Correct 634 ms 100524 KB Output is correct
10 Correct 638 ms 100624 KB Output is correct
11 Correct 618 ms 100756 KB Output is correct
12 Correct 628 ms 100604 KB Output is correct
13 Correct 638 ms 100580 KB Output is correct
14 Correct 648 ms 100716 KB Output is correct
15 Correct 622 ms 100628 KB Output is correct
16 Correct 632 ms 100624 KB Output is correct
17 Correct 636 ms 100652 KB Output is correct
18 Correct 631 ms 100704 KB Output is correct
19 Correct 634 ms 100516 KB Output is correct
20 Correct 628 ms 100644 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 622 ms 100556 KB Output is correct
23 Correct 639 ms 100592 KB Output is correct
24 Correct 629 ms 100716 KB Output is correct
25 Correct 667 ms 100608 KB Output is correct
26 Correct 624 ms 100608 KB Output is correct
27 Correct 623 ms 100736 KB Output is correct
28 Correct 642 ms 100676 KB Output is correct
29 Correct 742 ms 100580 KB Output is correct
30 Correct 666 ms 100680 KB Output is correct
31 Correct 768 ms 100644 KB Output is correct
32 Correct 681 ms 100600 KB Output is correct
33 Correct 674 ms 100528 KB Output is correct
34 Correct 648 ms 100628 KB Output is correct
35 Correct 659 ms 100624 KB Output is correct
36 Correct 631 ms 100640 KB Output is correct
37 Correct 632 ms 100548 KB Output is correct
38 Correct 640 ms 100624 KB Output is correct
39 Correct 629 ms 100536 KB Output is correct
40 Correct 637 ms 100788 KB Output is correct
41 Correct 632 ms 100628 KB Output is correct
42 Correct 639 ms 100552 KB Output is correct
43 Correct 622 ms 100532 KB Output is correct
44 Correct 634 ms 100520 KB Output is correct
45 Correct 625 ms 100536 KB Output is correct
46 Correct 659 ms 100752 KB Output is correct
47 Correct 637 ms 100552 KB Output is correct
48 Correct 641 ms 100632 KB Output is correct
49 Correct 634 ms 100632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 100812 KB Output is correct
2 Correct 646 ms 100744 KB Output is correct
3 Correct 623 ms 100628 KB Output is correct
4 Correct 625 ms 100600 KB Output is correct
5 Correct 629 ms 100572 KB Output is correct
6 Correct 634 ms 100632 KB Output is correct
7 Correct 623 ms 100632 KB Output is correct
8 Correct 634 ms 100560 KB Output is correct
9 Correct 634 ms 100524 KB Output is correct
10 Correct 638 ms 100624 KB Output is correct
11 Correct 618 ms 100756 KB Output is correct
12 Correct 628 ms 100604 KB Output is correct
13 Correct 638 ms 100580 KB Output is correct
14 Correct 648 ms 100716 KB Output is correct
15 Correct 622 ms 100628 KB Output is correct
16 Correct 632 ms 100624 KB Output is correct
17 Correct 636 ms 100652 KB Output is correct
18 Correct 631 ms 100704 KB Output is correct
19 Correct 634 ms 100516 KB Output is correct
20 Correct 628 ms 100644 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 622 ms 100556 KB Output is correct
23 Correct 639 ms 100592 KB Output is correct
24 Correct 629 ms 100716 KB Output is correct
25 Correct 667 ms 100608 KB Output is correct
26 Correct 624 ms 100608 KB Output is correct
27 Correct 623 ms 100736 KB Output is correct
28 Correct 642 ms 100676 KB Output is correct
29 Correct 742 ms 100580 KB Output is correct
30 Correct 666 ms 100680 KB Output is correct
31 Correct 768 ms 100644 KB Output is correct
32 Correct 681 ms 100600 KB Output is correct
33 Correct 674 ms 100528 KB Output is correct
34 Correct 648 ms 100628 KB Output is correct
35 Correct 659 ms 100624 KB Output is correct
36 Correct 631 ms 100640 KB Output is correct
37 Correct 632 ms 100548 KB Output is correct
38 Correct 640 ms 100624 KB Output is correct
39 Correct 629 ms 100536 KB Output is correct
40 Correct 637 ms 100788 KB Output is correct
41 Correct 632 ms 100628 KB Output is correct
42 Correct 639 ms 100552 KB Output is correct
43 Correct 622 ms 100532 KB Output is correct
44 Correct 634 ms 100520 KB Output is correct
45 Correct 625 ms 100536 KB Output is correct
46 Correct 659 ms 100752 KB Output is correct
47 Correct 637 ms 100552 KB Output is correct
48 Correct 641 ms 100632 KB Output is correct
49 Correct 634 ms 100632 KB Output is correct
50 Correct 636 ms 100748 KB Output is correct
51 Correct 691 ms 100764 KB Output is correct
52 Correct 626 ms 100732 KB Output is correct
53 Correct 637 ms 100564 KB Output is correct
54 Correct 639 ms 100696 KB Output is correct
55 Correct 633 ms 100772 KB Output is correct
56 Correct 642 ms 100720 KB Output is correct
57 Correct 637 ms 100732 KB Output is correct
58 Correct 633 ms 100592 KB Output is correct
59 Correct 637 ms 100648 KB Output is correct
60 Correct 641 ms 100648 KB Output is correct
61 Correct 636 ms 100740 KB Output is correct
62 Correct 643 ms 100548 KB Output is correct
63 Correct 626 ms 100612 KB Output is correct
64 Correct 659 ms 100688 KB Output is correct
65 Correct 625 ms 100556 KB Output is correct
66 Correct 650 ms 100660 KB Output is correct
67 Correct 646 ms 100596 KB Output is correct
68 Correct 624 ms 100696 KB Output is correct
69 Correct 633 ms 100628 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 100812 KB Output is correct
2 Correct 646 ms 100744 KB Output is correct
3 Correct 623 ms 100628 KB Output is correct
4 Correct 625 ms 100600 KB Output is correct
5 Correct 629 ms 100572 KB Output is correct
6 Correct 634 ms 100632 KB Output is correct
7 Correct 623 ms 100632 KB Output is correct
8 Correct 634 ms 100560 KB Output is correct
9 Correct 634 ms 100524 KB Output is correct
10 Correct 638 ms 100624 KB Output is correct
11 Correct 618 ms 100756 KB Output is correct
12 Correct 628 ms 100604 KB Output is correct
13 Correct 638 ms 100580 KB Output is correct
14 Correct 648 ms 100716 KB Output is correct
15 Correct 622 ms 100628 KB Output is correct
16 Correct 632 ms 100624 KB Output is correct
17 Correct 636 ms 100652 KB Output is correct
18 Correct 631 ms 100704 KB Output is correct
19 Correct 634 ms 100516 KB Output is correct
20 Correct 628 ms 100644 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 622 ms 100556 KB Output is correct
23 Correct 639 ms 100592 KB Output is correct
24 Correct 629 ms 100716 KB Output is correct
25 Correct 667 ms 100608 KB Output is correct
26 Correct 624 ms 100608 KB Output is correct
27 Correct 623 ms 100736 KB Output is correct
28 Correct 642 ms 100676 KB Output is correct
29 Correct 742 ms 100580 KB Output is correct
30 Correct 666 ms 100680 KB Output is correct
31 Correct 768 ms 100644 KB Output is correct
32 Correct 681 ms 100600 KB Output is correct
33 Correct 674 ms 100528 KB Output is correct
34 Correct 648 ms 100628 KB Output is correct
35 Correct 659 ms 100624 KB Output is correct
36 Correct 631 ms 100640 KB Output is correct
37 Correct 632 ms 100548 KB Output is correct
38 Correct 640 ms 100624 KB Output is correct
39 Correct 629 ms 100536 KB Output is correct
40 Correct 637 ms 100788 KB Output is correct
41 Correct 632 ms 100628 KB Output is correct
42 Correct 639 ms 100552 KB Output is correct
43 Correct 622 ms 100532 KB Output is correct
44 Correct 634 ms 100520 KB Output is correct
45 Correct 625 ms 100536 KB Output is correct
46 Correct 659 ms 100752 KB Output is correct
47 Correct 637 ms 100552 KB Output is correct
48 Correct 641 ms 100632 KB Output is correct
49 Correct 634 ms 100632 KB Output is correct
50 Correct 636 ms 100748 KB Output is correct
51 Correct 691 ms 100764 KB Output is correct
52 Correct 626 ms 100732 KB Output is correct
53 Correct 637 ms 100564 KB Output is correct
54 Correct 639 ms 100696 KB Output is correct
55 Correct 633 ms 100772 KB Output is correct
56 Correct 642 ms 100720 KB Output is correct
57 Correct 637 ms 100732 KB Output is correct
58 Correct 633 ms 100592 KB Output is correct
59 Correct 637 ms 100648 KB Output is correct
60 Correct 641 ms 100648 KB Output is correct
61 Correct 636 ms 100740 KB Output is correct
62 Correct 643 ms 100548 KB Output is correct
63 Correct 626 ms 100612 KB Output is correct
64 Correct 659 ms 100688 KB Output is correct
65 Correct 625 ms 100556 KB Output is correct
66 Correct 650 ms 100660 KB Output is correct
67 Correct 646 ms 100596 KB Output is correct
68 Correct 624 ms 100696 KB Output is correct
69 Correct 633 ms 100628 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
71 Runtime error 669 ms 203852 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 620 ms 100812 KB Output is correct
2 Correct 646 ms 100744 KB Output is correct
3 Correct 623 ms 100628 KB Output is correct
4 Correct 625 ms 100600 KB Output is correct
5 Correct 629 ms 100572 KB Output is correct
6 Correct 634 ms 100632 KB Output is correct
7 Correct 623 ms 100632 KB Output is correct
8 Correct 634 ms 100560 KB Output is correct
9 Correct 634 ms 100524 KB Output is correct
10 Correct 638 ms 100624 KB Output is correct
11 Correct 618 ms 100756 KB Output is correct
12 Correct 628 ms 100604 KB Output is correct
13 Correct 638 ms 100580 KB Output is correct
14 Correct 648 ms 100716 KB Output is correct
15 Correct 622 ms 100628 KB Output is correct
16 Correct 632 ms 100624 KB Output is correct
17 Correct 636 ms 100652 KB Output is correct
18 Correct 631 ms 100704 KB Output is correct
19 Correct 634 ms 100516 KB Output is correct
20 Correct 628 ms 100644 KB Output is correct
21 Correct 645 ms 100556 KB Output is correct
22 Correct 622 ms 100556 KB Output is correct
23 Correct 639 ms 100592 KB Output is correct
24 Correct 629 ms 100716 KB Output is correct
25 Correct 667 ms 100608 KB Output is correct
26 Correct 624 ms 100608 KB Output is correct
27 Correct 623 ms 100736 KB Output is correct
28 Correct 642 ms 100676 KB Output is correct
29 Correct 742 ms 100580 KB Output is correct
30 Correct 666 ms 100680 KB Output is correct
31 Correct 768 ms 100644 KB Output is correct
32 Correct 681 ms 100600 KB Output is correct
33 Correct 674 ms 100528 KB Output is correct
34 Correct 648 ms 100628 KB Output is correct
35 Correct 659 ms 100624 KB Output is correct
36 Correct 631 ms 100640 KB Output is correct
37 Correct 632 ms 100548 KB Output is correct
38 Correct 640 ms 100624 KB Output is correct
39 Correct 629 ms 100536 KB Output is correct
40 Correct 637 ms 100788 KB Output is correct
41 Correct 632 ms 100628 KB Output is correct
42 Correct 639 ms 100552 KB Output is correct
43 Correct 622 ms 100532 KB Output is correct
44 Correct 634 ms 100520 KB Output is correct
45 Correct 625 ms 100536 KB Output is correct
46 Correct 659 ms 100752 KB Output is correct
47 Correct 637 ms 100552 KB Output is correct
48 Correct 641 ms 100632 KB Output is correct
49 Correct 634 ms 100632 KB Output is correct
50 Correct 636 ms 100748 KB Output is correct
51 Correct 691 ms 100764 KB Output is correct
52 Correct 626 ms 100732 KB Output is correct
53 Correct 637 ms 100564 KB Output is correct
54 Correct 639 ms 100696 KB Output is correct
55 Correct 633 ms 100772 KB Output is correct
56 Correct 642 ms 100720 KB Output is correct
57 Correct 637 ms 100732 KB Output is correct
58 Correct 633 ms 100592 KB Output is correct
59 Correct 637 ms 100648 KB Output is correct
60 Correct 641 ms 100648 KB Output is correct
61 Correct 636 ms 100740 KB Output is correct
62 Correct 643 ms 100548 KB Output is correct
63 Correct 626 ms 100612 KB Output is correct
64 Correct 659 ms 100688 KB Output is correct
65 Correct 625 ms 100556 KB Output is correct
66 Correct 650 ms 100660 KB Output is correct
67 Correct 646 ms 100596 KB Output is correct
68 Correct 624 ms 100696 KB Output is correct
69 Correct 633 ms 100628 KB Output is correct
70 Correct 634 ms 100652 KB Output is correct
71 Runtime error 669 ms 203852 KB Execution killed with signal 11
72 Halted 0 ms 0 KB -