답안 #1094992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094992 2024-10-01T06:52:10 Z alexander707070 Toys (CEOI18_toy) C++14
59 / 100
242 ms 262144 KB
#include<bits/stdc++.h>
#define MAXN 1007
using namespace std;

int n;
vector<int> dels;
vector<int> sums[MAXN][MAXN];
unordered_map<int,int> pos;
set<int> ans;

vector<int> ff(int d,int mins){
	if(mins>d)return {dels[d]-1};
	if(dels[d]%dels[mins]!=0)return ff(d,mins+1);

	if(!sums[d][mins].empty())return sums[d][mins];

	sums[d][mins] = ff(d,mins+1);
	vector<int> s=ff(pos[dels[d]/dels[mins]],mins);

	for(int i:s){
		sums[d][mins].push_back(i+dels[mins]-1);
	}

	return sums[d][mins];
}

int main(){

	cin>>n;
	for(int i=1;i*i<=n;i++){
		if(n%i!=0)continue;

		dels.push_back(i);
		if(i!=n/i)dels.push_back(n/i);
	}

	sort(dels.begin(),dels.end());

	for(int i=0;i<dels.size();i++){
		pos[dels[i]]=i;
	}

	vector<int> w=ff(dels.size()-1,1);
	for(int i:w)ans.insert(i);

	cout<<ans.size()<<"\n";
	for(int i:ans){
		cout<<i<<" ";
	}
	cout<<"\n";

    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:39:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |  for(int i=0;i<dels.size();i++){
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 24156 KB Output is correct
2 Correct 10 ms 24220 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 11 ms 24152 KB Output is correct
5 Correct 11 ms 24156 KB Output is correct
6 Correct 11 ms 24156 KB Output is correct
7 Correct 10 ms 24152 KB Output is correct
8 Correct 11 ms 24156 KB Output is correct
9 Correct 9 ms 24156 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 10 ms 24152 KB Output is correct
12 Correct 11 ms 24156 KB Output is correct
13 Correct 10 ms 24156 KB Output is correct
14 Correct 10 ms 24156 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 13 ms 24152 KB Output is correct
17 Correct 14 ms 24156 KB Output is correct
18 Correct 11 ms 24156 KB Output is correct
19 Correct 12 ms 24156 KB Output is correct
20 Correct 9 ms 24156 KB Output is correct
21 Correct 9 ms 24152 KB Output is correct
22 Correct 10 ms 24152 KB Output is correct
23 Correct 9 ms 24156 KB Output is correct
24 Correct 11 ms 24156 KB Output is correct
25 Correct 10 ms 24152 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 24156 KB Output is correct
2 Correct 10 ms 24220 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 11 ms 24152 KB Output is correct
5 Correct 11 ms 24156 KB Output is correct
6 Correct 11 ms 24156 KB Output is correct
7 Correct 10 ms 24152 KB Output is correct
8 Correct 11 ms 24156 KB Output is correct
9 Correct 9 ms 24156 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 10 ms 24152 KB Output is correct
12 Correct 11 ms 24156 KB Output is correct
13 Correct 10 ms 24156 KB Output is correct
14 Correct 10 ms 24156 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 13 ms 24152 KB Output is correct
17 Correct 14 ms 24156 KB Output is correct
18 Correct 11 ms 24156 KB Output is correct
19 Correct 12 ms 24156 KB Output is correct
20 Correct 9 ms 24156 KB Output is correct
21 Correct 9 ms 24152 KB Output is correct
22 Correct 10 ms 24152 KB Output is correct
23 Correct 9 ms 24156 KB Output is correct
24 Correct 11 ms 24156 KB Output is correct
25 Correct 10 ms 24152 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 13 ms 24412 KB Output is correct
28 Correct 10 ms 24100 KB Output is correct
29 Correct 11 ms 24156 KB Output is correct
30 Correct 10 ms 24156 KB Output is correct
31 Correct 11 ms 24508 KB Output is correct
32 Correct 10 ms 24408 KB Output is correct
33 Correct 11 ms 24412 KB Output is correct
34 Correct 9 ms 24156 KB Output is correct
35 Correct 10 ms 24252 KB Output is correct
36 Correct 11 ms 24152 KB Output is correct
37 Correct 10 ms 24152 KB Output is correct
38 Correct 11 ms 24156 KB Output is correct
39 Correct 11 ms 24204 KB Output is correct
40 Correct 12 ms 24244 KB Output is correct
41 Correct 10 ms 24156 KB Output is correct
42 Correct 10 ms 24156 KB Output is correct
43 Correct 11 ms 24268 KB Output is correct
44 Correct 11 ms 24156 KB Output is correct
45 Correct 11 ms 24068 KB Output is correct
46 Correct 11 ms 24156 KB Output is correct
47 Correct 10 ms 24332 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 10 ms 24176 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 24156 KB Output is correct
2 Correct 10 ms 24220 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 11 ms 24152 KB Output is correct
5 Correct 11 ms 24156 KB Output is correct
6 Correct 11 ms 24156 KB Output is correct
7 Correct 10 ms 24152 KB Output is correct
8 Correct 11 ms 24156 KB Output is correct
9 Correct 9 ms 24156 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 10 ms 24152 KB Output is correct
12 Correct 11 ms 24156 KB Output is correct
13 Correct 10 ms 24156 KB Output is correct
14 Correct 10 ms 24156 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 13 ms 24152 KB Output is correct
17 Correct 14 ms 24156 KB Output is correct
18 Correct 11 ms 24156 KB Output is correct
19 Correct 12 ms 24156 KB Output is correct
20 Correct 9 ms 24156 KB Output is correct
21 Correct 9 ms 24152 KB Output is correct
22 Correct 10 ms 24152 KB Output is correct
23 Correct 9 ms 24156 KB Output is correct
24 Correct 11 ms 24156 KB Output is correct
25 Correct 10 ms 24152 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 13 ms 24412 KB Output is correct
28 Correct 10 ms 24100 KB Output is correct
29 Correct 11 ms 24156 KB Output is correct
30 Correct 10 ms 24156 KB Output is correct
31 Correct 11 ms 24508 KB Output is correct
32 Correct 10 ms 24408 KB Output is correct
33 Correct 11 ms 24412 KB Output is correct
34 Correct 9 ms 24156 KB Output is correct
35 Correct 10 ms 24252 KB Output is correct
36 Correct 11 ms 24152 KB Output is correct
37 Correct 10 ms 24152 KB Output is correct
38 Correct 11 ms 24156 KB Output is correct
39 Correct 11 ms 24204 KB Output is correct
40 Correct 12 ms 24244 KB Output is correct
41 Correct 10 ms 24156 KB Output is correct
42 Correct 10 ms 24156 KB Output is correct
43 Correct 11 ms 24268 KB Output is correct
44 Correct 11 ms 24156 KB Output is correct
45 Correct 11 ms 24068 KB Output is correct
46 Correct 11 ms 24156 KB Output is correct
47 Correct 10 ms 24332 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 10 ms 24176 KB Output is correct
50 Correct 14 ms 25388 KB Output is correct
51 Correct 11 ms 25180 KB Output is correct
52 Correct 11 ms 25176 KB Output is correct
53 Correct 12 ms 24924 KB Output is correct
54 Correct 11 ms 24668 KB Output is correct
55 Correct 13 ms 25928 KB Output is correct
56 Correct 12 ms 25692 KB Output is correct
57 Correct 12 ms 25436 KB Output is correct
58 Correct 11 ms 24204 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 10 ms 24156 KB Output is correct
61 Correct 11 ms 24720 KB Output is correct
62 Correct 11 ms 24528 KB Output is correct
63 Correct 12 ms 24368 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 12 ms 24668 KB Output is correct
66 Correct 10 ms 24248 KB Output is correct
67 Correct 10 ms 24156 KB Output is correct
68 Correct 10 ms 24156 KB Output is correct
69 Correct 11 ms 24108 KB Output is correct
70 Correct 11 ms 24412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 24156 KB Output is correct
2 Correct 10 ms 24220 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 11 ms 24152 KB Output is correct
5 Correct 11 ms 24156 KB Output is correct
6 Correct 11 ms 24156 KB Output is correct
7 Correct 10 ms 24152 KB Output is correct
8 Correct 11 ms 24156 KB Output is correct
9 Correct 9 ms 24156 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 10 ms 24152 KB Output is correct
12 Correct 11 ms 24156 KB Output is correct
13 Correct 10 ms 24156 KB Output is correct
14 Correct 10 ms 24156 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 13 ms 24152 KB Output is correct
17 Correct 14 ms 24156 KB Output is correct
18 Correct 11 ms 24156 KB Output is correct
19 Correct 12 ms 24156 KB Output is correct
20 Correct 9 ms 24156 KB Output is correct
21 Correct 9 ms 24152 KB Output is correct
22 Correct 10 ms 24152 KB Output is correct
23 Correct 9 ms 24156 KB Output is correct
24 Correct 11 ms 24156 KB Output is correct
25 Correct 10 ms 24152 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 13 ms 24412 KB Output is correct
28 Correct 10 ms 24100 KB Output is correct
29 Correct 11 ms 24156 KB Output is correct
30 Correct 10 ms 24156 KB Output is correct
31 Correct 11 ms 24508 KB Output is correct
32 Correct 10 ms 24408 KB Output is correct
33 Correct 11 ms 24412 KB Output is correct
34 Correct 9 ms 24156 KB Output is correct
35 Correct 10 ms 24252 KB Output is correct
36 Correct 11 ms 24152 KB Output is correct
37 Correct 10 ms 24152 KB Output is correct
38 Correct 11 ms 24156 KB Output is correct
39 Correct 11 ms 24204 KB Output is correct
40 Correct 12 ms 24244 KB Output is correct
41 Correct 10 ms 24156 KB Output is correct
42 Correct 10 ms 24156 KB Output is correct
43 Correct 11 ms 24268 KB Output is correct
44 Correct 11 ms 24156 KB Output is correct
45 Correct 11 ms 24068 KB Output is correct
46 Correct 11 ms 24156 KB Output is correct
47 Correct 10 ms 24332 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 10 ms 24176 KB Output is correct
50 Correct 14 ms 25388 KB Output is correct
51 Correct 11 ms 25180 KB Output is correct
52 Correct 11 ms 25176 KB Output is correct
53 Correct 12 ms 24924 KB Output is correct
54 Correct 11 ms 24668 KB Output is correct
55 Correct 13 ms 25928 KB Output is correct
56 Correct 12 ms 25692 KB Output is correct
57 Correct 12 ms 25436 KB Output is correct
58 Correct 11 ms 24204 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 10 ms 24156 KB Output is correct
61 Correct 11 ms 24720 KB Output is correct
62 Correct 11 ms 24528 KB Output is correct
63 Correct 12 ms 24368 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 12 ms 24668 KB Output is correct
66 Correct 10 ms 24248 KB Output is correct
67 Correct 10 ms 24156 KB Output is correct
68 Correct 10 ms 24156 KB Output is correct
69 Correct 11 ms 24108 KB Output is correct
70 Correct 11 ms 24412 KB Output is correct
71 Correct 214 ms 215812 KB Output is correct
72 Correct 147 ms 151968 KB Output is correct
73 Correct 242 ms 221868 KB Output is correct
74 Correct 102 ms 117816 KB Output is correct
75 Correct 125 ms 143984 KB Output is correct
76 Runtime error 127 ms 262144 KB Execution killed with signal 9
77 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 24156 KB Output is correct
2 Correct 10 ms 24220 KB Output is correct
3 Correct 10 ms 24156 KB Output is correct
4 Correct 11 ms 24152 KB Output is correct
5 Correct 11 ms 24156 KB Output is correct
6 Correct 11 ms 24156 KB Output is correct
7 Correct 10 ms 24152 KB Output is correct
8 Correct 11 ms 24156 KB Output is correct
9 Correct 9 ms 24156 KB Output is correct
10 Correct 10 ms 24156 KB Output is correct
11 Correct 10 ms 24152 KB Output is correct
12 Correct 11 ms 24156 KB Output is correct
13 Correct 10 ms 24156 KB Output is correct
14 Correct 10 ms 24156 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 13 ms 24152 KB Output is correct
17 Correct 14 ms 24156 KB Output is correct
18 Correct 11 ms 24156 KB Output is correct
19 Correct 12 ms 24156 KB Output is correct
20 Correct 9 ms 24156 KB Output is correct
21 Correct 9 ms 24152 KB Output is correct
22 Correct 10 ms 24152 KB Output is correct
23 Correct 9 ms 24156 KB Output is correct
24 Correct 11 ms 24156 KB Output is correct
25 Correct 10 ms 24152 KB Output is correct
26 Correct 11 ms 24412 KB Output is correct
27 Correct 13 ms 24412 KB Output is correct
28 Correct 10 ms 24100 KB Output is correct
29 Correct 11 ms 24156 KB Output is correct
30 Correct 10 ms 24156 KB Output is correct
31 Correct 11 ms 24508 KB Output is correct
32 Correct 10 ms 24408 KB Output is correct
33 Correct 11 ms 24412 KB Output is correct
34 Correct 9 ms 24156 KB Output is correct
35 Correct 10 ms 24252 KB Output is correct
36 Correct 11 ms 24152 KB Output is correct
37 Correct 10 ms 24152 KB Output is correct
38 Correct 11 ms 24156 KB Output is correct
39 Correct 11 ms 24204 KB Output is correct
40 Correct 12 ms 24244 KB Output is correct
41 Correct 10 ms 24156 KB Output is correct
42 Correct 10 ms 24156 KB Output is correct
43 Correct 11 ms 24268 KB Output is correct
44 Correct 11 ms 24156 KB Output is correct
45 Correct 11 ms 24068 KB Output is correct
46 Correct 11 ms 24156 KB Output is correct
47 Correct 10 ms 24332 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 10 ms 24176 KB Output is correct
50 Correct 14 ms 25388 KB Output is correct
51 Correct 11 ms 25180 KB Output is correct
52 Correct 11 ms 25176 KB Output is correct
53 Correct 12 ms 24924 KB Output is correct
54 Correct 11 ms 24668 KB Output is correct
55 Correct 13 ms 25928 KB Output is correct
56 Correct 12 ms 25692 KB Output is correct
57 Correct 12 ms 25436 KB Output is correct
58 Correct 11 ms 24204 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 10 ms 24156 KB Output is correct
61 Correct 11 ms 24720 KB Output is correct
62 Correct 11 ms 24528 KB Output is correct
63 Correct 12 ms 24368 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 12 ms 24668 KB Output is correct
66 Correct 10 ms 24248 KB Output is correct
67 Correct 10 ms 24156 KB Output is correct
68 Correct 10 ms 24156 KB Output is correct
69 Correct 11 ms 24108 KB Output is correct
70 Correct 11 ms 24412 KB Output is correct
71 Correct 214 ms 215812 KB Output is correct
72 Correct 147 ms 151968 KB Output is correct
73 Correct 242 ms 221868 KB Output is correct
74 Correct 102 ms 117816 KB Output is correct
75 Correct 125 ms 143984 KB Output is correct
76 Runtime error 127 ms 262144 KB Execution killed with signal 9
77 Halted 0 ms 0 KB -