답안 #584988

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
584988 2022-06-28T08:12:26 Z hibiki Toys (CEOI18_toy) C++11
39 / 100
5000 ms 6460 KB
#include<bits/stdc++.h>
using namespace std;

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

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

int main()
{
    sum[1].insert(0);
    for(int i = 2; i < 10005; 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 30 ms 6360 KB Output is correct
2 Correct 28 ms 6356 KB Output is correct
3 Correct 30 ms 6416 KB Output is correct
4 Correct 29 ms 6348 KB Output is correct
5 Correct 33 ms 6416 KB Output is correct
6 Correct 35 ms 6344 KB Output is correct
7 Correct 38 ms 6324 KB Output is correct
8 Correct 40 ms 6444 KB Output is correct
9 Correct 32 ms 6428 KB Output is correct
10 Correct 32 ms 6348 KB Output is correct
11 Correct 36 ms 6416 KB Output is correct
12 Correct 34 ms 6428 KB Output is correct
13 Correct 34 ms 6420 KB Output is correct
14 Correct 31 ms 6348 KB Output is correct
15 Correct 32 ms 6368 KB Output is correct
16 Correct 34 ms 6316 KB Output is correct
17 Correct 33 ms 6444 KB Output is correct
18 Correct 36 ms 6404 KB Output is correct
19 Correct 36 ms 6348 KB Output is correct
20 Correct 30 ms 6436 KB Output is correct
21 Correct 32 ms 6360 KB Output is correct
22 Correct 30 ms 6328 KB Output is correct
23 Correct 29 ms 6328 KB Output is correct
24 Correct 32 ms 6452 KB Output is correct
25 Correct 36 ms 6364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 6360 KB Output is correct
2 Correct 28 ms 6356 KB Output is correct
3 Correct 30 ms 6416 KB Output is correct
4 Correct 29 ms 6348 KB Output is correct
5 Correct 33 ms 6416 KB Output is correct
6 Correct 35 ms 6344 KB Output is correct
7 Correct 38 ms 6324 KB Output is correct
8 Correct 40 ms 6444 KB Output is correct
9 Correct 32 ms 6428 KB Output is correct
10 Correct 32 ms 6348 KB Output is correct
11 Correct 36 ms 6416 KB Output is correct
12 Correct 34 ms 6428 KB Output is correct
13 Correct 34 ms 6420 KB Output is correct
14 Correct 31 ms 6348 KB Output is correct
15 Correct 32 ms 6368 KB Output is correct
16 Correct 34 ms 6316 KB Output is correct
17 Correct 33 ms 6444 KB Output is correct
18 Correct 36 ms 6404 KB Output is correct
19 Correct 36 ms 6348 KB Output is correct
20 Correct 30 ms 6436 KB Output is correct
21 Correct 32 ms 6360 KB Output is correct
22 Correct 30 ms 6328 KB Output is correct
23 Correct 29 ms 6328 KB Output is correct
24 Correct 32 ms 6452 KB Output is correct
25 Correct 36 ms 6364 KB Output is correct
26 Correct 35 ms 6420 KB Output is correct
27 Correct 31 ms 6332 KB Output is correct
28 Correct 35 ms 6356 KB Output is correct
29 Correct 30 ms 6368 KB Output is correct
30 Correct 36 ms 6328 KB Output is correct
31 Correct 30 ms 6364 KB Output is correct
32 Correct 31 ms 6364 KB Output is correct
33 Correct 34 ms 6444 KB Output is correct
34 Correct 38 ms 6404 KB Output is correct
35 Correct 30 ms 6380 KB Output is correct
36 Correct 30 ms 6432 KB Output is correct
37 Correct 40 ms 6348 KB Output is correct
38 Correct 32 ms 6396 KB Output is correct
39 Correct 29 ms 6400 KB Output is correct
40 Correct 38 ms 6448 KB Output is correct
41 Correct 36 ms 6336 KB Output is correct
42 Correct 30 ms 6460 KB Output is correct
43 Correct 28 ms 6356 KB Output is correct
44 Correct 29 ms 6368 KB Output is correct
45 Correct 28 ms 6432 KB Output is correct
46 Correct 28 ms 6348 KB Output is correct
47 Correct 34 ms 6448 KB Output is correct
48 Correct 36 ms 6436 KB Output is correct
49 Correct 29 ms 6396 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 6360 KB Output is correct
2 Correct 28 ms 6356 KB Output is correct
3 Correct 30 ms 6416 KB Output is correct
4 Correct 29 ms 6348 KB Output is correct
5 Correct 33 ms 6416 KB Output is correct
6 Correct 35 ms 6344 KB Output is correct
7 Correct 38 ms 6324 KB Output is correct
8 Correct 40 ms 6444 KB Output is correct
9 Correct 32 ms 6428 KB Output is correct
10 Correct 32 ms 6348 KB Output is correct
11 Correct 36 ms 6416 KB Output is correct
12 Correct 34 ms 6428 KB Output is correct
13 Correct 34 ms 6420 KB Output is correct
14 Correct 31 ms 6348 KB Output is correct
15 Correct 32 ms 6368 KB Output is correct
16 Correct 34 ms 6316 KB Output is correct
17 Correct 33 ms 6444 KB Output is correct
18 Correct 36 ms 6404 KB Output is correct
19 Correct 36 ms 6348 KB Output is correct
20 Correct 30 ms 6436 KB Output is correct
21 Correct 32 ms 6360 KB Output is correct
22 Correct 30 ms 6328 KB Output is correct
23 Correct 29 ms 6328 KB Output is correct
24 Correct 32 ms 6452 KB Output is correct
25 Correct 36 ms 6364 KB Output is correct
26 Correct 35 ms 6420 KB Output is correct
27 Correct 31 ms 6332 KB Output is correct
28 Correct 35 ms 6356 KB Output is correct
29 Correct 30 ms 6368 KB Output is correct
30 Correct 36 ms 6328 KB Output is correct
31 Correct 30 ms 6364 KB Output is correct
32 Correct 31 ms 6364 KB Output is correct
33 Correct 34 ms 6444 KB Output is correct
34 Correct 38 ms 6404 KB Output is correct
35 Correct 30 ms 6380 KB Output is correct
36 Correct 30 ms 6432 KB Output is correct
37 Correct 40 ms 6348 KB Output is correct
38 Correct 32 ms 6396 KB Output is correct
39 Correct 29 ms 6400 KB Output is correct
40 Correct 38 ms 6448 KB Output is correct
41 Correct 36 ms 6336 KB Output is correct
42 Correct 30 ms 6460 KB Output is correct
43 Correct 28 ms 6356 KB Output is correct
44 Correct 29 ms 6368 KB Output is correct
45 Correct 28 ms 6432 KB Output is correct
46 Correct 28 ms 6348 KB Output is correct
47 Correct 34 ms 6448 KB Output is correct
48 Correct 36 ms 6436 KB Output is correct
49 Correct 29 ms 6396 KB Output is correct
50 Execution timed out 5059 ms 6440 KB Time limit exceeded
51 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 6360 KB Output is correct
2 Correct 28 ms 6356 KB Output is correct
3 Correct 30 ms 6416 KB Output is correct
4 Correct 29 ms 6348 KB Output is correct
5 Correct 33 ms 6416 KB Output is correct
6 Correct 35 ms 6344 KB Output is correct
7 Correct 38 ms 6324 KB Output is correct
8 Correct 40 ms 6444 KB Output is correct
9 Correct 32 ms 6428 KB Output is correct
10 Correct 32 ms 6348 KB Output is correct
11 Correct 36 ms 6416 KB Output is correct
12 Correct 34 ms 6428 KB Output is correct
13 Correct 34 ms 6420 KB Output is correct
14 Correct 31 ms 6348 KB Output is correct
15 Correct 32 ms 6368 KB Output is correct
16 Correct 34 ms 6316 KB Output is correct
17 Correct 33 ms 6444 KB Output is correct
18 Correct 36 ms 6404 KB Output is correct
19 Correct 36 ms 6348 KB Output is correct
20 Correct 30 ms 6436 KB Output is correct
21 Correct 32 ms 6360 KB Output is correct
22 Correct 30 ms 6328 KB Output is correct
23 Correct 29 ms 6328 KB Output is correct
24 Correct 32 ms 6452 KB Output is correct
25 Correct 36 ms 6364 KB Output is correct
26 Correct 35 ms 6420 KB Output is correct
27 Correct 31 ms 6332 KB Output is correct
28 Correct 35 ms 6356 KB Output is correct
29 Correct 30 ms 6368 KB Output is correct
30 Correct 36 ms 6328 KB Output is correct
31 Correct 30 ms 6364 KB Output is correct
32 Correct 31 ms 6364 KB Output is correct
33 Correct 34 ms 6444 KB Output is correct
34 Correct 38 ms 6404 KB Output is correct
35 Correct 30 ms 6380 KB Output is correct
36 Correct 30 ms 6432 KB Output is correct
37 Correct 40 ms 6348 KB Output is correct
38 Correct 32 ms 6396 KB Output is correct
39 Correct 29 ms 6400 KB Output is correct
40 Correct 38 ms 6448 KB Output is correct
41 Correct 36 ms 6336 KB Output is correct
42 Correct 30 ms 6460 KB Output is correct
43 Correct 28 ms 6356 KB Output is correct
44 Correct 29 ms 6368 KB Output is correct
45 Correct 28 ms 6432 KB Output is correct
46 Correct 28 ms 6348 KB Output is correct
47 Correct 34 ms 6448 KB Output is correct
48 Correct 36 ms 6436 KB Output is correct
49 Correct 29 ms 6396 KB Output is correct
50 Execution timed out 5059 ms 6440 KB Time limit exceeded
51 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 30 ms 6360 KB Output is correct
2 Correct 28 ms 6356 KB Output is correct
3 Correct 30 ms 6416 KB Output is correct
4 Correct 29 ms 6348 KB Output is correct
5 Correct 33 ms 6416 KB Output is correct
6 Correct 35 ms 6344 KB Output is correct
7 Correct 38 ms 6324 KB Output is correct
8 Correct 40 ms 6444 KB Output is correct
9 Correct 32 ms 6428 KB Output is correct
10 Correct 32 ms 6348 KB Output is correct
11 Correct 36 ms 6416 KB Output is correct
12 Correct 34 ms 6428 KB Output is correct
13 Correct 34 ms 6420 KB Output is correct
14 Correct 31 ms 6348 KB Output is correct
15 Correct 32 ms 6368 KB Output is correct
16 Correct 34 ms 6316 KB Output is correct
17 Correct 33 ms 6444 KB Output is correct
18 Correct 36 ms 6404 KB Output is correct
19 Correct 36 ms 6348 KB Output is correct
20 Correct 30 ms 6436 KB Output is correct
21 Correct 32 ms 6360 KB Output is correct
22 Correct 30 ms 6328 KB Output is correct
23 Correct 29 ms 6328 KB Output is correct
24 Correct 32 ms 6452 KB Output is correct
25 Correct 36 ms 6364 KB Output is correct
26 Correct 35 ms 6420 KB Output is correct
27 Correct 31 ms 6332 KB Output is correct
28 Correct 35 ms 6356 KB Output is correct
29 Correct 30 ms 6368 KB Output is correct
30 Correct 36 ms 6328 KB Output is correct
31 Correct 30 ms 6364 KB Output is correct
32 Correct 31 ms 6364 KB Output is correct
33 Correct 34 ms 6444 KB Output is correct
34 Correct 38 ms 6404 KB Output is correct
35 Correct 30 ms 6380 KB Output is correct
36 Correct 30 ms 6432 KB Output is correct
37 Correct 40 ms 6348 KB Output is correct
38 Correct 32 ms 6396 KB Output is correct
39 Correct 29 ms 6400 KB Output is correct
40 Correct 38 ms 6448 KB Output is correct
41 Correct 36 ms 6336 KB Output is correct
42 Correct 30 ms 6460 KB Output is correct
43 Correct 28 ms 6356 KB Output is correct
44 Correct 29 ms 6368 KB Output is correct
45 Correct 28 ms 6432 KB Output is correct
46 Correct 28 ms 6348 KB Output is correct
47 Correct 34 ms 6448 KB Output is correct
48 Correct 36 ms 6436 KB Output is correct
49 Correct 29 ms 6396 KB Output is correct
50 Execution timed out 5059 ms 6440 KB Time limit exceeded
51 Halted 0 ms 0 KB -