답안 #383537

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
383537 2021-03-30T08:53:01 Z maximath_1 Toys (CEOI18_toy) C++11
100 / 100
3114 ms 94980 KB
#include <stdio.h>
#include <string>
#include <math.h>
#include <algorithm>
#include <vector>
#include <string.h>
#include <numeric>
#include <queue>
#include <assert.h>
#include <map>
#include <set>
#include <limits.h>
using namespace std;
 
#define ll long long
#define ld long double
const int MX = 100005;
const int LG = (int)log2(MX) + 2;
const int BLOCK = 105;
const ll mod = 1e9 + 7;
const ll inv2 = (mod + 1) / 2;
 
#define gc getchar//_unlocked //can't for window server
void cin(int &x){
	char c = gc(); bool neg = false;
	for(; c < '0'||'9' < c; c = gc())
		if(c == '-') neg=true;
	x = c - '0'; c = gc();
	for(; '0' <= c && c <= '9'; c = gc())
		x = (x << 1) + (x << 3) + (c - '0');
	if(neg) x = -x;
}

int n;
vector<int> divi;
set<int> v[100005];

int main(){
	cin(n);

	for(int i = 1; i * i <= n; i ++) if(n % i == 0){
		divi.push_back(i);
		if(i * i != n)
			divi.push_back(n / i);
	}
	sort(divi.begin(), divi.end());

	v[0].insert(0);
	for(int i = 1; i < divi.size(); i ++){
		for(int j = 0; j < i; j ++) if(divi[i] % divi[j] == 0){
			for(int k : v[j])
				v[i].insert(k + (divi[i] / divi[j] - 1));
		}
	}

	set<int> ans = v[divi.size() - 1];
	printf("%d\n", ans.size());
	for(int i : ans)
		printf("%d ", i);
	printf("\n");
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:49:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |  for(int i = 1; i < divi.size(); i ++){
      |                 ~~^~~~~~~~~~~~~
toy.cpp:57:11: warning: format '%d' expects argument of type 'int', but argument 2 has type 'std::set<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
   57 |  printf("%d\n", ans.size());
      |          ~^     ~~~~~~~~~~
      |           |             |
      |           int           std::set<int>::size_type {aka long unsigned int}
      |          %ld
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 5 ms 4972 KB Output is correct
3 Correct 4 ms 4972 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 5100 KB Output is correct
10 Correct 5 ms 5100 KB Output is correct
11 Correct 4 ms 4972 KB Output is correct
12 Correct 5 ms 4972 KB Output is correct
13 Correct 4 ms 4972 KB Output is correct
14 Correct 4 ms 4972 KB Output is correct
15 Correct 4 ms 4972 KB Output is correct
16 Correct 4 ms 4976 KB Output is correct
17 Correct 4 ms 4972 KB Output is correct
18 Correct 5 ms 4972 KB Output is correct
19 Correct 4 ms 4972 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
21 Correct 5 ms 4972 KB Output is correct
22 Correct 4 ms 4972 KB Output is correct
23 Correct 5 ms 4972 KB Output is correct
24 Correct 5 ms 4972 KB Output is correct
25 Correct 5 ms 5100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 5 ms 4972 KB Output is correct
3 Correct 4 ms 4972 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 5100 KB Output is correct
10 Correct 5 ms 5100 KB Output is correct
11 Correct 4 ms 4972 KB Output is correct
12 Correct 5 ms 4972 KB Output is correct
13 Correct 4 ms 4972 KB Output is correct
14 Correct 4 ms 4972 KB Output is correct
15 Correct 4 ms 4972 KB Output is correct
16 Correct 4 ms 4976 KB Output is correct
17 Correct 4 ms 4972 KB Output is correct
18 Correct 5 ms 4972 KB Output is correct
19 Correct 4 ms 4972 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
21 Correct 5 ms 4972 KB Output is correct
22 Correct 4 ms 4972 KB Output is correct
23 Correct 5 ms 4972 KB Output is correct
24 Correct 5 ms 4972 KB Output is correct
25 Correct 5 ms 5100 KB Output is correct
26 Correct 5 ms 5100 KB Output is correct
27 Correct 5 ms 5120 KB Output is correct
28 Correct 4 ms 4972 KB Output is correct
29 Correct 4 ms 4972 KB Output is correct
30 Correct 4 ms 4972 KB Output is correct
31 Correct 5 ms 5100 KB Output is correct
32 Correct 5 ms 5100 KB Output is correct
33 Correct 5 ms 5100 KB Output is correct
34 Correct 4 ms 4972 KB Output is correct
35 Correct 4 ms 4972 KB Output is correct
36 Correct 4 ms 4972 KB Output is correct
37 Correct 4 ms 5100 KB Output is correct
38 Correct 4 ms 4972 KB Output is correct
39 Correct 4 ms 4972 KB Output is correct
40 Correct 4 ms 5100 KB Output is correct
41 Correct 4 ms 4972 KB Output is correct
42 Correct 5 ms 4972 KB Output is correct
43 Correct 4 ms 4972 KB Output is correct
44 Correct 4 ms 4972 KB Output is correct
45 Correct 4 ms 4972 KB Output is correct
46 Correct 4 ms 4972 KB Output is correct
47 Correct 5 ms 5100 KB Output is correct
48 Correct 4 ms 4972 KB Output is correct
49 Correct 4 ms 4972 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 5 ms 4972 KB Output is correct
3 Correct 4 ms 4972 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 5100 KB Output is correct
10 Correct 5 ms 5100 KB Output is correct
11 Correct 4 ms 4972 KB Output is correct
12 Correct 5 ms 4972 KB Output is correct
13 Correct 4 ms 4972 KB Output is correct
14 Correct 4 ms 4972 KB Output is correct
15 Correct 4 ms 4972 KB Output is correct
16 Correct 4 ms 4976 KB Output is correct
17 Correct 4 ms 4972 KB Output is correct
18 Correct 5 ms 4972 KB Output is correct
19 Correct 4 ms 4972 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
21 Correct 5 ms 4972 KB Output is correct
22 Correct 4 ms 4972 KB Output is correct
23 Correct 5 ms 4972 KB Output is correct
24 Correct 5 ms 4972 KB Output is correct
25 Correct 5 ms 5100 KB Output is correct
26 Correct 5 ms 5100 KB Output is correct
27 Correct 5 ms 5120 KB Output is correct
28 Correct 4 ms 4972 KB Output is correct
29 Correct 4 ms 4972 KB Output is correct
30 Correct 4 ms 4972 KB Output is correct
31 Correct 5 ms 5100 KB Output is correct
32 Correct 5 ms 5100 KB Output is correct
33 Correct 5 ms 5100 KB Output is correct
34 Correct 4 ms 4972 KB Output is correct
35 Correct 4 ms 4972 KB Output is correct
36 Correct 4 ms 4972 KB Output is correct
37 Correct 4 ms 5100 KB Output is correct
38 Correct 4 ms 4972 KB Output is correct
39 Correct 4 ms 4972 KB Output is correct
40 Correct 4 ms 5100 KB Output is correct
41 Correct 4 ms 4972 KB Output is correct
42 Correct 5 ms 4972 KB Output is correct
43 Correct 4 ms 4972 KB Output is correct
44 Correct 4 ms 4972 KB Output is correct
45 Correct 4 ms 4972 KB Output is correct
46 Correct 4 ms 4972 KB Output is correct
47 Correct 5 ms 5100 KB Output is correct
48 Correct 4 ms 4972 KB Output is correct
49 Correct 4 ms 4972 KB Output is correct
50 Correct 7 ms 5356 KB Output is correct
51 Correct 7 ms 5228 KB Output is correct
52 Correct 7 ms 5228 KB Output is correct
53 Correct 7 ms 5228 KB Output is correct
54 Correct 5 ms 5100 KB Output is correct
55 Correct 8 ms 5376 KB Output is correct
56 Correct 8 ms 5356 KB Output is correct
57 Correct 8 ms 5356 KB Output is correct
58 Correct 4 ms 4972 KB Output is correct
59 Correct 4 ms 4972 KB Output is correct
60 Correct 4 ms 5100 KB Output is correct
61 Correct 6 ms 5228 KB Output is correct
62 Correct 6 ms 5100 KB Output is correct
63 Correct 5 ms 5100 KB Output is correct
64 Correct 4 ms 4972 KB Output is correct
65 Correct 6 ms 5228 KB Output is correct
66 Correct 4 ms 4972 KB Output is correct
67 Correct 4 ms 4972 KB Output is correct
68 Correct 4 ms 4972 KB Output is correct
69 Correct 4 ms 4972 KB Output is correct
70 Correct 5 ms 5100 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 5 ms 4972 KB Output is correct
3 Correct 4 ms 4972 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 5100 KB Output is correct
10 Correct 5 ms 5100 KB Output is correct
11 Correct 4 ms 4972 KB Output is correct
12 Correct 5 ms 4972 KB Output is correct
13 Correct 4 ms 4972 KB Output is correct
14 Correct 4 ms 4972 KB Output is correct
15 Correct 4 ms 4972 KB Output is correct
16 Correct 4 ms 4976 KB Output is correct
17 Correct 4 ms 4972 KB Output is correct
18 Correct 5 ms 4972 KB Output is correct
19 Correct 4 ms 4972 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
21 Correct 5 ms 4972 KB Output is correct
22 Correct 4 ms 4972 KB Output is correct
23 Correct 5 ms 4972 KB Output is correct
24 Correct 5 ms 4972 KB Output is correct
25 Correct 5 ms 5100 KB Output is correct
26 Correct 5 ms 5100 KB Output is correct
27 Correct 5 ms 5120 KB Output is correct
28 Correct 4 ms 4972 KB Output is correct
29 Correct 4 ms 4972 KB Output is correct
30 Correct 4 ms 4972 KB Output is correct
31 Correct 5 ms 5100 KB Output is correct
32 Correct 5 ms 5100 KB Output is correct
33 Correct 5 ms 5100 KB Output is correct
34 Correct 4 ms 4972 KB Output is correct
35 Correct 4 ms 4972 KB Output is correct
36 Correct 4 ms 4972 KB Output is correct
37 Correct 4 ms 5100 KB Output is correct
38 Correct 4 ms 4972 KB Output is correct
39 Correct 4 ms 4972 KB Output is correct
40 Correct 4 ms 5100 KB Output is correct
41 Correct 4 ms 4972 KB Output is correct
42 Correct 5 ms 4972 KB Output is correct
43 Correct 4 ms 4972 KB Output is correct
44 Correct 4 ms 4972 KB Output is correct
45 Correct 4 ms 4972 KB Output is correct
46 Correct 4 ms 4972 KB Output is correct
47 Correct 5 ms 5100 KB Output is correct
48 Correct 4 ms 4972 KB Output is correct
49 Correct 4 ms 4972 KB Output is correct
50 Correct 7 ms 5356 KB Output is correct
51 Correct 7 ms 5228 KB Output is correct
52 Correct 7 ms 5228 KB Output is correct
53 Correct 7 ms 5228 KB Output is correct
54 Correct 5 ms 5100 KB Output is correct
55 Correct 8 ms 5376 KB Output is correct
56 Correct 8 ms 5356 KB Output is correct
57 Correct 8 ms 5356 KB Output is correct
58 Correct 4 ms 4972 KB Output is correct
59 Correct 4 ms 4972 KB Output is correct
60 Correct 4 ms 5100 KB Output is correct
61 Correct 6 ms 5228 KB Output is correct
62 Correct 6 ms 5100 KB Output is correct
63 Correct 5 ms 5100 KB Output is correct
64 Correct 4 ms 4972 KB Output is correct
65 Correct 6 ms 5228 KB Output is correct
66 Correct 4 ms 4972 KB Output is correct
67 Correct 4 ms 4972 KB Output is correct
68 Correct 4 ms 4972 KB Output is correct
69 Correct 4 ms 4972 KB Output is correct
70 Correct 5 ms 5100 KB Output is correct
71 Correct 432 ms 24244 KB Output is correct
72 Correct 303 ms 19616 KB Output is correct
73 Correct 397 ms 21996 KB Output is correct
74 Correct 224 ms 16492 KB Output is correct
75 Correct 261 ms 17260 KB Output is correct
76 Correct 688 ms 30788 KB Output is correct
77 Correct 611 ms 27628 KB Output is correct
78 Correct 531 ms 26348 KB Output is correct
79 Correct 528 ms 25696 KB Output is correct
80 Correct 6 ms 4972 KB Output is correct
81 Correct 5 ms 4972 KB Output is correct
82 Correct 9 ms 5356 KB Output is correct
83 Correct 62 ms 8684 KB Output is correct
84 Correct 77 ms 9452 KB Output is correct
85 Correct 19 ms 6380 KB Output is correct
86 Correct 4 ms 4972 KB Output is correct
87 Correct 85 ms 10092 KB Output is correct
88 Correct 4 ms 4972 KB Output is correct
89 Correct 4 ms 4972 KB Output is correct
90 Correct 4 ms 4972 KB Output is correct
91 Correct 24 ms 7020 KB Output is correct
92 Correct 100 ms 11756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 4972 KB Output is correct
2 Correct 5 ms 4972 KB Output is correct
3 Correct 4 ms 4972 KB Output is correct
4 Correct 4 ms 4972 KB Output is correct
5 Correct 4 ms 4972 KB Output is correct
6 Correct 4 ms 4972 KB Output is correct
7 Correct 4 ms 4972 KB Output is correct
8 Correct 4 ms 4972 KB Output is correct
9 Correct 4 ms 5100 KB Output is correct
10 Correct 5 ms 5100 KB Output is correct
11 Correct 4 ms 4972 KB Output is correct
12 Correct 5 ms 4972 KB Output is correct
13 Correct 4 ms 4972 KB Output is correct
14 Correct 4 ms 4972 KB Output is correct
15 Correct 4 ms 4972 KB Output is correct
16 Correct 4 ms 4976 KB Output is correct
17 Correct 4 ms 4972 KB Output is correct
18 Correct 5 ms 4972 KB Output is correct
19 Correct 4 ms 4972 KB Output is correct
20 Correct 4 ms 4972 KB Output is correct
21 Correct 5 ms 4972 KB Output is correct
22 Correct 4 ms 4972 KB Output is correct
23 Correct 5 ms 4972 KB Output is correct
24 Correct 5 ms 4972 KB Output is correct
25 Correct 5 ms 5100 KB Output is correct
26 Correct 5 ms 5100 KB Output is correct
27 Correct 5 ms 5120 KB Output is correct
28 Correct 4 ms 4972 KB Output is correct
29 Correct 4 ms 4972 KB Output is correct
30 Correct 4 ms 4972 KB Output is correct
31 Correct 5 ms 5100 KB Output is correct
32 Correct 5 ms 5100 KB Output is correct
33 Correct 5 ms 5100 KB Output is correct
34 Correct 4 ms 4972 KB Output is correct
35 Correct 4 ms 4972 KB Output is correct
36 Correct 4 ms 4972 KB Output is correct
37 Correct 4 ms 5100 KB Output is correct
38 Correct 4 ms 4972 KB Output is correct
39 Correct 4 ms 4972 KB Output is correct
40 Correct 4 ms 5100 KB Output is correct
41 Correct 4 ms 4972 KB Output is correct
42 Correct 5 ms 4972 KB Output is correct
43 Correct 4 ms 4972 KB Output is correct
44 Correct 4 ms 4972 KB Output is correct
45 Correct 4 ms 4972 KB Output is correct
46 Correct 4 ms 4972 KB Output is correct
47 Correct 5 ms 5100 KB Output is correct
48 Correct 4 ms 4972 KB Output is correct
49 Correct 4 ms 4972 KB Output is correct
50 Correct 7 ms 5356 KB Output is correct
51 Correct 7 ms 5228 KB Output is correct
52 Correct 7 ms 5228 KB Output is correct
53 Correct 7 ms 5228 KB Output is correct
54 Correct 5 ms 5100 KB Output is correct
55 Correct 8 ms 5376 KB Output is correct
56 Correct 8 ms 5356 KB Output is correct
57 Correct 8 ms 5356 KB Output is correct
58 Correct 4 ms 4972 KB Output is correct
59 Correct 4 ms 4972 KB Output is correct
60 Correct 4 ms 5100 KB Output is correct
61 Correct 6 ms 5228 KB Output is correct
62 Correct 6 ms 5100 KB Output is correct
63 Correct 5 ms 5100 KB Output is correct
64 Correct 4 ms 4972 KB Output is correct
65 Correct 6 ms 5228 KB Output is correct
66 Correct 4 ms 4972 KB Output is correct
67 Correct 4 ms 4972 KB Output is correct
68 Correct 4 ms 4972 KB Output is correct
69 Correct 4 ms 4972 KB Output is correct
70 Correct 5 ms 5100 KB Output is correct
71 Correct 432 ms 24244 KB Output is correct
72 Correct 303 ms 19616 KB Output is correct
73 Correct 397 ms 21996 KB Output is correct
74 Correct 224 ms 16492 KB Output is correct
75 Correct 261 ms 17260 KB Output is correct
76 Correct 688 ms 30788 KB Output is correct
77 Correct 611 ms 27628 KB Output is correct
78 Correct 531 ms 26348 KB Output is correct
79 Correct 528 ms 25696 KB Output is correct
80 Correct 6 ms 4972 KB Output is correct
81 Correct 5 ms 4972 KB Output is correct
82 Correct 9 ms 5356 KB Output is correct
83 Correct 62 ms 8684 KB Output is correct
84 Correct 77 ms 9452 KB Output is correct
85 Correct 19 ms 6380 KB Output is correct
86 Correct 4 ms 4972 KB Output is correct
87 Correct 85 ms 10092 KB Output is correct
88 Correct 4 ms 4972 KB Output is correct
89 Correct 4 ms 4972 KB Output is correct
90 Correct 4 ms 4972 KB Output is correct
91 Correct 24 ms 7020 KB Output is correct
92 Correct 100 ms 11756 KB Output is correct
93 Correct 2478 ms 85400 KB Output is correct
94 Correct 1381 ms 59560 KB Output is correct
95 Correct 1610 ms 62052 KB Output is correct
96 Correct 1447 ms 55620 KB Output is correct
97 Correct 1324 ms 51052 KB Output is correct
98 Correct 2912 ms 93540 KB Output is correct
99 Correct 3114 ms 94980 KB Output is correct
100 Correct 2828 ms 91392 KB Output is correct
101 Correct 2758 ms 85184 KB Output is correct
102 Correct 2354 ms 77080 KB Output is correct
103 Correct 1864 ms 69888 KB Output is correct
104 Correct 4 ms 4972 KB Output is correct
105 Correct 5 ms 4972 KB Output is correct
106 Correct 12 ms 5740 KB Output is correct
107 Correct 225 ms 15040 KB Output is correct
108 Correct 498 ms 26364 KB Output is correct
109 Correct 53 ms 8300 KB Output is correct
110 Correct 5 ms 4972 KB Output is correct
111 Correct 254 ms 17900 KB Output is correct
112 Correct 4 ms 4972 KB Output is correct
113 Correct 5 ms 4972 KB Output is correct
114 Correct 10 ms 5740 KB Output is correct
115 Correct 4 ms 4972 KB Output is correct
116 Correct 19 ms 6636 KB Output is correct
117 Correct 479 ms 30956 KB Output is correct