답안 #1094996

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

int n;
vector<int> dels;

unordered_set<int> sums[MAXN][MAXN];
unordered_map<int,int> pos;
unordered_set<int> res;
vector<int> ans;

unordered_set<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);
	unordered_set<int> s=ff(pos[dels[d]/dels[mins]],mins);

	for(int i:s){
		sums[d][mins].insert(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;
	}
	
	res=ff(dels.size()-1,1);
	for(int i:res)ans.push_back(i);

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

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

    return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:42:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   42 |  for(int i=0;i<dels.size();i++){
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 55900 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 26 ms 55900 KB Output is correct
4 Correct 25 ms 55900 KB Output is correct
5 Correct 25 ms 55900 KB Output is correct
6 Correct 24 ms 55796 KB Output is correct
7 Correct 24 ms 55900 KB Output is correct
8 Correct 23 ms 55844 KB Output is correct
9 Correct 25 ms 55900 KB Output is correct
10 Correct 26 ms 55900 KB Output is correct
11 Correct 24 ms 55900 KB Output is correct
12 Correct 25 ms 55900 KB Output is correct
13 Correct 32 ms 55824 KB Output is correct
14 Correct 30 ms 55892 KB Output is correct
15 Correct 24 ms 55988 KB Output is correct
16 Correct 24 ms 55900 KB Output is correct
17 Correct 25 ms 55900 KB Output is correct
18 Correct 30 ms 55896 KB Output is correct
19 Correct 23 ms 55896 KB Output is correct
20 Correct 24 ms 55900 KB Output is correct
21 Correct 26 ms 55896 KB Output is correct
22 Correct 24 ms 55900 KB Output is correct
23 Correct 23 ms 55896 KB Output is correct
24 Correct 25 ms 55760 KB Output is correct
25 Correct 25 ms 55900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 55900 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 26 ms 55900 KB Output is correct
4 Correct 25 ms 55900 KB Output is correct
5 Correct 25 ms 55900 KB Output is correct
6 Correct 24 ms 55796 KB Output is correct
7 Correct 24 ms 55900 KB Output is correct
8 Correct 23 ms 55844 KB Output is correct
9 Correct 25 ms 55900 KB Output is correct
10 Correct 26 ms 55900 KB Output is correct
11 Correct 24 ms 55900 KB Output is correct
12 Correct 25 ms 55900 KB Output is correct
13 Correct 32 ms 55824 KB Output is correct
14 Correct 30 ms 55892 KB Output is correct
15 Correct 24 ms 55988 KB Output is correct
16 Correct 24 ms 55900 KB Output is correct
17 Correct 25 ms 55900 KB Output is correct
18 Correct 30 ms 55896 KB Output is correct
19 Correct 23 ms 55896 KB Output is correct
20 Correct 24 ms 55900 KB Output is correct
21 Correct 26 ms 55896 KB Output is correct
22 Correct 24 ms 55900 KB Output is correct
23 Correct 23 ms 55896 KB Output is correct
24 Correct 25 ms 55760 KB Output is correct
25 Correct 25 ms 55900 KB Output is correct
26 Correct 25 ms 56468 KB Output is correct
27 Correct 24 ms 56412 KB Output is correct
28 Correct 25 ms 56228 KB Output is correct
29 Correct 27 ms 55896 KB Output is correct
30 Correct 27 ms 56100 KB Output is correct
31 Correct 25 ms 56412 KB Output is correct
32 Correct 24 ms 56412 KB Output is correct
33 Correct 24 ms 56412 KB Output is correct
34 Correct 24 ms 55800 KB Output is correct
35 Correct 25 ms 55788 KB Output is correct
36 Correct 24 ms 55896 KB Output is correct
37 Correct 24 ms 56156 KB Output is correct
38 Correct 24 ms 56084 KB Output is correct
39 Correct 27 ms 55900 KB Output is correct
40 Correct 34 ms 56148 KB Output is correct
41 Correct 24 ms 55900 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 25 ms 55888 KB Output is correct
44 Correct 25 ms 55840 KB Output is correct
45 Correct 23 ms 55896 KB Output is correct
46 Correct 25 ms 55896 KB Output is correct
47 Correct 24 ms 56156 KB Output is correct
48 Correct 26 ms 55896 KB Output is correct
49 Correct 25 ms 55900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 55900 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 26 ms 55900 KB Output is correct
4 Correct 25 ms 55900 KB Output is correct
5 Correct 25 ms 55900 KB Output is correct
6 Correct 24 ms 55796 KB Output is correct
7 Correct 24 ms 55900 KB Output is correct
8 Correct 23 ms 55844 KB Output is correct
9 Correct 25 ms 55900 KB Output is correct
10 Correct 26 ms 55900 KB Output is correct
11 Correct 24 ms 55900 KB Output is correct
12 Correct 25 ms 55900 KB Output is correct
13 Correct 32 ms 55824 KB Output is correct
14 Correct 30 ms 55892 KB Output is correct
15 Correct 24 ms 55988 KB Output is correct
16 Correct 24 ms 55900 KB Output is correct
17 Correct 25 ms 55900 KB Output is correct
18 Correct 30 ms 55896 KB Output is correct
19 Correct 23 ms 55896 KB Output is correct
20 Correct 24 ms 55900 KB Output is correct
21 Correct 26 ms 55896 KB Output is correct
22 Correct 24 ms 55900 KB Output is correct
23 Correct 23 ms 55896 KB Output is correct
24 Correct 25 ms 55760 KB Output is correct
25 Correct 25 ms 55900 KB Output is correct
26 Correct 25 ms 56468 KB Output is correct
27 Correct 24 ms 56412 KB Output is correct
28 Correct 25 ms 56228 KB Output is correct
29 Correct 27 ms 55896 KB Output is correct
30 Correct 27 ms 56100 KB Output is correct
31 Correct 25 ms 56412 KB Output is correct
32 Correct 24 ms 56412 KB Output is correct
33 Correct 24 ms 56412 KB Output is correct
34 Correct 24 ms 55800 KB Output is correct
35 Correct 25 ms 55788 KB Output is correct
36 Correct 24 ms 55896 KB Output is correct
37 Correct 24 ms 56156 KB Output is correct
38 Correct 24 ms 56084 KB Output is correct
39 Correct 27 ms 55900 KB Output is correct
40 Correct 34 ms 56148 KB Output is correct
41 Correct 24 ms 55900 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 25 ms 55888 KB Output is correct
44 Correct 25 ms 55840 KB Output is correct
45 Correct 23 ms 55896 KB Output is correct
46 Correct 25 ms 55896 KB Output is correct
47 Correct 24 ms 56156 KB Output is correct
48 Correct 26 ms 55896 KB Output is correct
49 Correct 25 ms 55900 KB Output is correct
50 Correct 31 ms 58712 KB Output is correct
51 Correct 29 ms 58200 KB Output is correct
52 Correct 29 ms 58204 KB Output is correct
53 Correct 28 ms 57936 KB Output is correct
54 Correct 28 ms 57128 KB Output is correct
55 Correct 31 ms 59616 KB Output is correct
56 Correct 31 ms 58972 KB Output is correct
57 Correct 31 ms 59228 KB Output is correct
58 Correct 26 ms 55980 KB Output is correct
59 Correct 25 ms 56004 KB Output is correct
60 Correct 25 ms 55900 KB Output is correct
61 Correct 27 ms 56924 KB Output is correct
62 Correct 27 ms 56688 KB Output is correct
63 Correct 25 ms 56152 KB Output is correct
64 Correct 26 ms 55900 KB Output is correct
65 Correct 31 ms 57172 KB Output is correct
66 Correct 25 ms 55900 KB Output is correct
67 Correct 27 ms 55900 KB Output is correct
68 Correct 26 ms 55900 KB Output is correct
69 Correct 26 ms 56148 KB Output is correct
70 Correct 27 ms 56924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 55900 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 26 ms 55900 KB Output is correct
4 Correct 25 ms 55900 KB Output is correct
5 Correct 25 ms 55900 KB Output is correct
6 Correct 24 ms 55796 KB Output is correct
7 Correct 24 ms 55900 KB Output is correct
8 Correct 23 ms 55844 KB Output is correct
9 Correct 25 ms 55900 KB Output is correct
10 Correct 26 ms 55900 KB Output is correct
11 Correct 24 ms 55900 KB Output is correct
12 Correct 25 ms 55900 KB Output is correct
13 Correct 32 ms 55824 KB Output is correct
14 Correct 30 ms 55892 KB Output is correct
15 Correct 24 ms 55988 KB Output is correct
16 Correct 24 ms 55900 KB Output is correct
17 Correct 25 ms 55900 KB Output is correct
18 Correct 30 ms 55896 KB Output is correct
19 Correct 23 ms 55896 KB Output is correct
20 Correct 24 ms 55900 KB Output is correct
21 Correct 26 ms 55896 KB Output is correct
22 Correct 24 ms 55900 KB Output is correct
23 Correct 23 ms 55896 KB Output is correct
24 Correct 25 ms 55760 KB Output is correct
25 Correct 25 ms 55900 KB Output is correct
26 Correct 25 ms 56468 KB Output is correct
27 Correct 24 ms 56412 KB Output is correct
28 Correct 25 ms 56228 KB Output is correct
29 Correct 27 ms 55896 KB Output is correct
30 Correct 27 ms 56100 KB Output is correct
31 Correct 25 ms 56412 KB Output is correct
32 Correct 24 ms 56412 KB Output is correct
33 Correct 24 ms 56412 KB Output is correct
34 Correct 24 ms 55800 KB Output is correct
35 Correct 25 ms 55788 KB Output is correct
36 Correct 24 ms 55896 KB Output is correct
37 Correct 24 ms 56156 KB Output is correct
38 Correct 24 ms 56084 KB Output is correct
39 Correct 27 ms 55900 KB Output is correct
40 Correct 34 ms 56148 KB Output is correct
41 Correct 24 ms 55900 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 25 ms 55888 KB Output is correct
44 Correct 25 ms 55840 KB Output is correct
45 Correct 23 ms 55896 KB Output is correct
46 Correct 25 ms 55896 KB Output is correct
47 Correct 24 ms 56156 KB Output is correct
48 Correct 26 ms 55896 KB Output is correct
49 Correct 25 ms 55900 KB Output is correct
50 Correct 31 ms 58712 KB Output is correct
51 Correct 29 ms 58200 KB Output is correct
52 Correct 29 ms 58204 KB Output is correct
53 Correct 28 ms 57936 KB Output is correct
54 Correct 28 ms 57128 KB Output is correct
55 Correct 31 ms 59616 KB Output is correct
56 Correct 31 ms 58972 KB Output is correct
57 Correct 31 ms 59228 KB Output is correct
58 Correct 26 ms 55980 KB Output is correct
59 Correct 25 ms 56004 KB Output is correct
60 Correct 25 ms 55900 KB Output is correct
61 Correct 27 ms 56924 KB Output is correct
62 Correct 27 ms 56688 KB Output is correct
63 Correct 25 ms 56152 KB Output is correct
64 Correct 26 ms 55900 KB Output is correct
65 Correct 31 ms 57172 KB Output is correct
66 Correct 25 ms 55900 KB Output is correct
67 Correct 27 ms 55900 KB Output is correct
68 Correct 26 ms 55900 KB Output is correct
69 Correct 26 ms 56148 KB Output is correct
70 Correct 27 ms 56924 KB Output is correct
71 Runtime error 218 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 55900 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 26 ms 55900 KB Output is correct
4 Correct 25 ms 55900 KB Output is correct
5 Correct 25 ms 55900 KB Output is correct
6 Correct 24 ms 55796 KB Output is correct
7 Correct 24 ms 55900 KB Output is correct
8 Correct 23 ms 55844 KB Output is correct
9 Correct 25 ms 55900 KB Output is correct
10 Correct 26 ms 55900 KB Output is correct
11 Correct 24 ms 55900 KB Output is correct
12 Correct 25 ms 55900 KB Output is correct
13 Correct 32 ms 55824 KB Output is correct
14 Correct 30 ms 55892 KB Output is correct
15 Correct 24 ms 55988 KB Output is correct
16 Correct 24 ms 55900 KB Output is correct
17 Correct 25 ms 55900 KB Output is correct
18 Correct 30 ms 55896 KB Output is correct
19 Correct 23 ms 55896 KB Output is correct
20 Correct 24 ms 55900 KB Output is correct
21 Correct 26 ms 55896 KB Output is correct
22 Correct 24 ms 55900 KB Output is correct
23 Correct 23 ms 55896 KB Output is correct
24 Correct 25 ms 55760 KB Output is correct
25 Correct 25 ms 55900 KB Output is correct
26 Correct 25 ms 56468 KB Output is correct
27 Correct 24 ms 56412 KB Output is correct
28 Correct 25 ms 56228 KB Output is correct
29 Correct 27 ms 55896 KB Output is correct
30 Correct 27 ms 56100 KB Output is correct
31 Correct 25 ms 56412 KB Output is correct
32 Correct 24 ms 56412 KB Output is correct
33 Correct 24 ms 56412 KB Output is correct
34 Correct 24 ms 55800 KB Output is correct
35 Correct 25 ms 55788 KB Output is correct
36 Correct 24 ms 55896 KB Output is correct
37 Correct 24 ms 56156 KB Output is correct
38 Correct 24 ms 56084 KB Output is correct
39 Correct 27 ms 55900 KB Output is correct
40 Correct 34 ms 56148 KB Output is correct
41 Correct 24 ms 55900 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 25 ms 55888 KB Output is correct
44 Correct 25 ms 55840 KB Output is correct
45 Correct 23 ms 55896 KB Output is correct
46 Correct 25 ms 55896 KB Output is correct
47 Correct 24 ms 56156 KB Output is correct
48 Correct 26 ms 55896 KB Output is correct
49 Correct 25 ms 55900 KB Output is correct
50 Correct 31 ms 58712 KB Output is correct
51 Correct 29 ms 58200 KB Output is correct
52 Correct 29 ms 58204 KB Output is correct
53 Correct 28 ms 57936 KB Output is correct
54 Correct 28 ms 57128 KB Output is correct
55 Correct 31 ms 59616 KB Output is correct
56 Correct 31 ms 58972 KB Output is correct
57 Correct 31 ms 59228 KB Output is correct
58 Correct 26 ms 55980 KB Output is correct
59 Correct 25 ms 56004 KB Output is correct
60 Correct 25 ms 55900 KB Output is correct
61 Correct 27 ms 56924 KB Output is correct
62 Correct 27 ms 56688 KB Output is correct
63 Correct 25 ms 56152 KB Output is correct
64 Correct 26 ms 55900 KB Output is correct
65 Correct 31 ms 57172 KB Output is correct
66 Correct 25 ms 55900 KB Output is correct
67 Correct 27 ms 55900 KB Output is correct
68 Correct 26 ms 55900 KB Output is correct
69 Correct 26 ms 56148 KB Output is correct
70 Correct 27 ms 56924 KB Output is correct
71 Runtime error 218 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -