답안 #223106

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
223106 2020-04-14T19:00:14 Z MKopchev Toys (CEOI18_toy) C++14
100 / 100
3907 ms 90496 KB
#include<bits/stdc++.h>
using namespace std;
map<int, set<int> > seen;

set<int> rec(int n)
{
    if(seen.count(n))return seen[n];

    set<int> ret={n-1};//use one type

    for(int i=2;i*i<=n;i++)
        if(n%i==0)
        {
            for(auto k:rec(n/i))
            {
                ret.insert(k+i-1);
            }
        }
    seen[n]=ret;
    return ret;
}
int main()
{
    int n;
    scanf("%i",&n);

    set<int> output=rec(n);

    printf("%i\n",output.size());
    for(auto k:output)
    {
        printf("%i",k);
        if(k!=n-1)printf(" ");
    }
    printf("\n");
    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:29:32: warning: format '%i' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type {aka long unsigned int}' [-Wformat=]
     printf("%i\n",output.size());
                   ~~~~~~~~~~~~~^
toy.cpp:25:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%i",&n);
     ~~~~~^~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 256 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
41 Correct 5 ms 256 KB Output is correct
42 Correct 5 ms 256 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 5 ms 256 KB Output is correct
45 Correct 5 ms 384 KB Output is correct
46 Correct 5 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 256 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 256 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
41 Correct 5 ms 256 KB Output is correct
42 Correct 5 ms 256 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 5 ms 256 KB Output is correct
45 Correct 5 ms 384 KB Output is correct
46 Correct 5 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 256 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 9 ms 640 KB Output is correct
51 Correct 8 ms 640 KB Output is correct
52 Correct 8 ms 640 KB Output is correct
53 Correct 8 ms 512 KB Output is correct
54 Correct 6 ms 512 KB Output is correct
55 Correct 12 ms 768 KB Output is correct
56 Correct 10 ms 768 KB Output is correct
57 Correct 9 ms 640 KB Output is correct
58 Correct 4 ms 256 KB Output is correct
59 Correct 5 ms 384 KB Output is correct
60 Correct 5 ms 384 KB Output is correct
61 Correct 9 ms 640 KB Output is correct
62 Correct 6 ms 512 KB Output is correct
63 Correct 5 ms 384 KB Output is correct
64 Correct 5 ms 256 KB Output is correct
65 Correct 7 ms 512 KB Output is correct
66 Correct 5 ms 256 KB Output is correct
67 Correct 5 ms 256 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 384 KB Output is correct
70 Correct 6 ms 384 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 256 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
41 Correct 5 ms 256 KB Output is correct
42 Correct 5 ms 256 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 5 ms 256 KB Output is correct
45 Correct 5 ms 384 KB Output is correct
46 Correct 5 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 256 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 9 ms 640 KB Output is correct
51 Correct 8 ms 640 KB Output is correct
52 Correct 8 ms 640 KB Output is correct
53 Correct 8 ms 512 KB Output is correct
54 Correct 6 ms 512 KB Output is correct
55 Correct 12 ms 768 KB Output is correct
56 Correct 10 ms 768 KB Output is correct
57 Correct 9 ms 640 KB Output is correct
58 Correct 4 ms 256 KB Output is correct
59 Correct 5 ms 384 KB Output is correct
60 Correct 5 ms 384 KB Output is correct
61 Correct 9 ms 640 KB Output is correct
62 Correct 6 ms 512 KB Output is correct
63 Correct 5 ms 384 KB Output is correct
64 Correct 5 ms 256 KB Output is correct
65 Correct 7 ms 512 KB Output is correct
66 Correct 5 ms 256 KB Output is correct
67 Correct 5 ms 256 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 384 KB Output is correct
70 Correct 6 ms 384 KB Output is correct
71 Correct 537 ms 19536 KB Output is correct
72 Correct 365 ms 14968 KB Output is correct
73 Correct 502 ms 17508 KB Output is correct
74 Correct 273 ms 11768 KB Output is correct
75 Correct 323 ms 12648 KB Output is correct
76 Correct 862 ms 26232 KB Output is correct
77 Correct 763 ms 23160 KB Output is correct
78 Correct 681 ms 21760 KB Output is correct
79 Correct 637 ms 21112 KB Output is correct
80 Correct 5 ms 256 KB Output is correct
81 Correct 5 ms 256 KB Output is correct
82 Correct 9 ms 768 KB Output is correct
83 Correct 75 ms 3960 KB Output is correct
84 Correct 97 ms 4728 KB Output is correct
85 Correct 24 ms 1664 KB Output is correct
86 Correct 5 ms 384 KB Output is correct
87 Correct 109 ms 5496 KB Output is correct
88 Correct 5 ms 384 KB Output is correct
89 Correct 5 ms 256 KB Output is correct
90 Correct 5 ms 384 KB Output is correct
91 Correct 30 ms 2424 KB Output is correct
92 Correct 125 ms 7160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 384 KB Output is correct
4 Correct 5 ms 384 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 5 ms 384 KB Output is correct
7 Correct 5 ms 384 KB Output is correct
8 Correct 5 ms 384 KB Output is correct
9 Correct 5 ms 384 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 4 ms 384 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 384 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 384 KB Output is correct
18 Correct 5 ms 384 KB Output is correct
19 Correct 5 ms 384 KB Output is correct
20 Correct 5 ms 384 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 384 KB Output is correct
23 Correct 4 ms 256 KB Output is correct
24 Correct 5 ms 384 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 384 KB Output is correct
27 Correct 5 ms 384 KB Output is correct
28 Correct 5 ms 384 KB Output is correct
29 Correct 5 ms 384 KB Output is correct
30 Correct 5 ms 384 KB Output is correct
31 Correct 5 ms 384 KB Output is correct
32 Correct 5 ms 384 KB Output is correct
33 Correct 5 ms 384 KB Output is correct
34 Correct 5 ms 384 KB Output is correct
35 Correct 5 ms 256 KB Output is correct
36 Correct 5 ms 384 KB Output is correct
37 Correct 5 ms 384 KB Output is correct
38 Correct 5 ms 384 KB Output is correct
39 Correct 5 ms 384 KB Output is correct
40 Correct 5 ms 384 KB Output is correct
41 Correct 5 ms 256 KB Output is correct
42 Correct 5 ms 256 KB Output is correct
43 Correct 5 ms 384 KB Output is correct
44 Correct 5 ms 256 KB Output is correct
45 Correct 5 ms 384 KB Output is correct
46 Correct 5 ms 384 KB Output is correct
47 Correct 5 ms 384 KB Output is correct
48 Correct 5 ms 256 KB Output is correct
49 Correct 5 ms 384 KB Output is correct
50 Correct 9 ms 640 KB Output is correct
51 Correct 8 ms 640 KB Output is correct
52 Correct 8 ms 640 KB Output is correct
53 Correct 8 ms 512 KB Output is correct
54 Correct 6 ms 512 KB Output is correct
55 Correct 12 ms 768 KB Output is correct
56 Correct 10 ms 768 KB Output is correct
57 Correct 9 ms 640 KB Output is correct
58 Correct 4 ms 256 KB Output is correct
59 Correct 5 ms 384 KB Output is correct
60 Correct 5 ms 384 KB Output is correct
61 Correct 9 ms 640 KB Output is correct
62 Correct 6 ms 512 KB Output is correct
63 Correct 5 ms 384 KB Output is correct
64 Correct 5 ms 256 KB Output is correct
65 Correct 7 ms 512 KB Output is correct
66 Correct 5 ms 256 KB Output is correct
67 Correct 5 ms 256 KB Output is correct
68 Correct 5 ms 256 KB Output is correct
69 Correct 5 ms 384 KB Output is correct
70 Correct 6 ms 384 KB Output is correct
71 Correct 537 ms 19536 KB Output is correct
72 Correct 365 ms 14968 KB Output is correct
73 Correct 502 ms 17508 KB Output is correct
74 Correct 273 ms 11768 KB Output is correct
75 Correct 323 ms 12648 KB Output is correct
76 Correct 862 ms 26232 KB Output is correct
77 Correct 763 ms 23160 KB Output is correct
78 Correct 681 ms 21760 KB Output is correct
79 Correct 637 ms 21112 KB Output is correct
80 Correct 5 ms 256 KB Output is correct
81 Correct 5 ms 256 KB Output is correct
82 Correct 9 ms 768 KB Output is correct
83 Correct 75 ms 3960 KB Output is correct
84 Correct 97 ms 4728 KB Output is correct
85 Correct 24 ms 1664 KB Output is correct
86 Correct 5 ms 384 KB Output is correct
87 Correct 109 ms 5496 KB Output is correct
88 Correct 5 ms 384 KB Output is correct
89 Correct 5 ms 256 KB Output is correct
90 Correct 5 ms 384 KB Output is correct
91 Correct 30 ms 2424 KB Output is correct
92 Correct 125 ms 7160 KB Output is correct
93 Correct 3253 ms 80728 KB Output is correct
94 Correct 1770 ms 54884 KB Output is correct
95 Correct 2033 ms 57204 KB Output is correct
96 Correct 1804 ms 51192 KB Output is correct
97 Correct 1625 ms 46436 KB Output is correct
98 Correct 3704 ms 89028 KB Output is correct
99 Correct 3907 ms 90496 KB Output is correct
100 Correct 3604 ms 87032 KB Output is correct
101 Correct 3441 ms 80824 KB Output is correct
102 Correct 3027 ms 72616 KB Output is correct
103 Correct 2385 ms 65400 KB Output is correct
104 Correct 5 ms 256 KB Output is correct
105 Correct 5 ms 256 KB Output is correct
106 Correct 13 ms 1024 KB Output is correct
107 Correct 240 ms 10360 KB Output is correct
108 Correct 640 ms 21892 KB Output is correct
109 Correct 57 ms 3576 KB Output is correct
110 Correct 5 ms 384 KB Output is correct
111 Correct 302 ms 13052 KB Output is correct
112 Correct 5 ms 384 KB Output is correct
113 Correct 5 ms 384 KB Output is correct
114 Correct 13 ms 1024 KB Output is correct
115 Correct 5 ms 256 KB Output is correct
116 Correct 24 ms 1920 KB Output is correct
117 Correct 614 ms 26488 KB Output is correct