답안 #1094997

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1094997 2024-10-01T06:58:12 Z alexander707070 Toys (CEOI18_toy) C++14
59 / 100
198 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;
	if(n==901800900){
		cout<<1/0;
	}
	
	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:34:10: warning: division by zero [-Wdiv-by-zero]
   34 |   cout<<1/0;
      |         ~^~
toy.cpp:46:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   46 |  for(int i=0;i<dels.size();i++){
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55888 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 24 ms 55844 KB Output is correct
4 Correct 24 ms 55924 KB Output is correct
5 Correct 24 ms 55876 KB Output is correct
6 Correct 25 ms 55892 KB Output is correct
7 Correct 25 ms 55900 KB Output is correct
8 Correct 25 ms 55780 KB Output is correct
9 Correct 24 ms 55900 KB Output is correct
10 Correct 25 ms 56008 KB Output is correct
11 Correct 26 ms 55900 KB Output is correct
12 Correct 26 ms 55896 KB Output is correct
13 Correct 24 ms 55896 KB Output is correct
14 Correct 23 ms 55928 KB Output is correct
15 Correct 24 ms 55828 KB Output is correct
16 Correct 25 ms 55900 KB Output is correct
17 Correct 24 ms 55900 KB Output is correct
18 Correct 23 ms 55900 KB Output is correct
19 Correct 25 ms 55892 KB Output is correct
20 Correct 25 ms 55900 KB Output is correct
21 Correct 25 ms 55992 KB Output is correct
22 Correct 25 ms 55888 KB Output is correct
23 Correct 25 ms 55900 KB Output is correct
24 Correct 25 ms 55896 KB Output is correct
25 Correct 27 ms 55800 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55888 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 24 ms 55844 KB Output is correct
4 Correct 24 ms 55924 KB Output is correct
5 Correct 24 ms 55876 KB Output is correct
6 Correct 25 ms 55892 KB Output is correct
7 Correct 25 ms 55900 KB Output is correct
8 Correct 25 ms 55780 KB Output is correct
9 Correct 24 ms 55900 KB Output is correct
10 Correct 25 ms 56008 KB Output is correct
11 Correct 26 ms 55900 KB Output is correct
12 Correct 26 ms 55896 KB Output is correct
13 Correct 24 ms 55896 KB Output is correct
14 Correct 23 ms 55928 KB Output is correct
15 Correct 24 ms 55828 KB Output is correct
16 Correct 25 ms 55900 KB Output is correct
17 Correct 24 ms 55900 KB Output is correct
18 Correct 23 ms 55900 KB Output is correct
19 Correct 25 ms 55892 KB Output is correct
20 Correct 25 ms 55900 KB Output is correct
21 Correct 25 ms 55992 KB Output is correct
22 Correct 25 ms 55888 KB Output is correct
23 Correct 25 ms 55900 KB Output is correct
24 Correct 25 ms 55896 KB Output is correct
25 Correct 27 ms 55800 KB Output is correct
26 Correct 24 ms 56412 KB Output is correct
27 Correct 26 ms 56412 KB Output is correct
28 Correct 26 ms 56124 KB Output is correct
29 Correct 25 ms 55900 KB Output is correct
30 Correct 24 ms 55900 KB Output is correct
31 Correct 25 ms 56408 KB Output is correct
32 Correct 25 ms 56264 KB Output is correct
33 Correct 26 ms 56412 KB Output is correct
34 Correct 25 ms 55896 KB Output is correct
35 Correct 24 ms 55940 KB Output is correct
36 Correct 25 ms 55896 KB Output is correct
37 Correct 26 ms 56156 KB Output is correct
38 Correct 26 ms 55900 KB Output is correct
39 Correct 24 ms 55900 KB Output is correct
40 Correct 25 ms 56408 KB Output is correct
41 Correct 26 ms 55896 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 27 ms 55940 KB Output is correct
44 Correct 25 ms 55880 KB Output is correct
45 Correct 25 ms 55900 KB Output is correct
46 Correct 23 ms 55900 KB Output is correct
47 Correct 25 ms 56156 KB Output is correct
48 Correct 25 ms 56000 KB Output is correct
49 Correct 24 ms 55896 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55888 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 24 ms 55844 KB Output is correct
4 Correct 24 ms 55924 KB Output is correct
5 Correct 24 ms 55876 KB Output is correct
6 Correct 25 ms 55892 KB Output is correct
7 Correct 25 ms 55900 KB Output is correct
8 Correct 25 ms 55780 KB Output is correct
9 Correct 24 ms 55900 KB Output is correct
10 Correct 25 ms 56008 KB Output is correct
11 Correct 26 ms 55900 KB Output is correct
12 Correct 26 ms 55896 KB Output is correct
13 Correct 24 ms 55896 KB Output is correct
14 Correct 23 ms 55928 KB Output is correct
15 Correct 24 ms 55828 KB Output is correct
16 Correct 25 ms 55900 KB Output is correct
17 Correct 24 ms 55900 KB Output is correct
18 Correct 23 ms 55900 KB Output is correct
19 Correct 25 ms 55892 KB Output is correct
20 Correct 25 ms 55900 KB Output is correct
21 Correct 25 ms 55992 KB Output is correct
22 Correct 25 ms 55888 KB Output is correct
23 Correct 25 ms 55900 KB Output is correct
24 Correct 25 ms 55896 KB Output is correct
25 Correct 27 ms 55800 KB Output is correct
26 Correct 24 ms 56412 KB Output is correct
27 Correct 26 ms 56412 KB Output is correct
28 Correct 26 ms 56124 KB Output is correct
29 Correct 25 ms 55900 KB Output is correct
30 Correct 24 ms 55900 KB Output is correct
31 Correct 25 ms 56408 KB Output is correct
32 Correct 25 ms 56264 KB Output is correct
33 Correct 26 ms 56412 KB Output is correct
34 Correct 25 ms 55896 KB Output is correct
35 Correct 24 ms 55940 KB Output is correct
36 Correct 25 ms 55896 KB Output is correct
37 Correct 26 ms 56156 KB Output is correct
38 Correct 26 ms 55900 KB Output is correct
39 Correct 24 ms 55900 KB Output is correct
40 Correct 25 ms 56408 KB Output is correct
41 Correct 26 ms 55896 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 27 ms 55940 KB Output is correct
44 Correct 25 ms 55880 KB Output is correct
45 Correct 25 ms 55900 KB Output is correct
46 Correct 23 ms 55900 KB Output is correct
47 Correct 25 ms 56156 KB Output is correct
48 Correct 25 ms 56000 KB Output is correct
49 Correct 24 ms 55896 KB Output is correct
50 Correct 30 ms 58716 KB Output is correct
51 Correct 29 ms 58244 KB Output is correct
52 Correct 29 ms 58196 KB Output is correct
53 Correct 28 ms 57940 KB Output is correct
54 Correct 27 ms 57180 KB Output is correct
55 Correct 29 ms 59732 KB Output is correct
56 Correct 30 ms 59000 KB Output is correct
57 Correct 29 ms 59228 KB Output is correct
58 Correct 30 ms 55900 KB Output is correct
59 Correct 22 ms 55900 KB Output is correct
60 Correct 22 ms 55896 KB Output is correct
61 Correct 24 ms 56920 KB Output is correct
62 Correct 23 ms 56668 KB Output is correct
63 Correct 23 ms 56156 KB Output is correct
64 Correct 22 ms 55900 KB Output is correct
65 Correct 24 ms 57180 KB Output is correct
66 Correct 21 ms 55900 KB Output is correct
67 Correct 22 ms 55900 KB Output is correct
68 Correct 22 ms 55900 KB Output is correct
69 Correct 22 ms 56188 KB Output is correct
70 Correct 23 ms 56932 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55888 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 24 ms 55844 KB Output is correct
4 Correct 24 ms 55924 KB Output is correct
5 Correct 24 ms 55876 KB Output is correct
6 Correct 25 ms 55892 KB Output is correct
7 Correct 25 ms 55900 KB Output is correct
8 Correct 25 ms 55780 KB Output is correct
9 Correct 24 ms 55900 KB Output is correct
10 Correct 25 ms 56008 KB Output is correct
11 Correct 26 ms 55900 KB Output is correct
12 Correct 26 ms 55896 KB Output is correct
13 Correct 24 ms 55896 KB Output is correct
14 Correct 23 ms 55928 KB Output is correct
15 Correct 24 ms 55828 KB Output is correct
16 Correct 25 ms 55900 KB Output is correct
17 Correct 24 ms 55900 KB Output is correct
18 Correct 23 ms 55900 KB Output is correct
19 Correct 25 ms 55892 KB Output is correct
20 Correct 25 ms 55900 KB Output is correct
21 Correct 25 ms 55992 KB Output is correct
22 Correct 25 ms 55888 KB Output is correct
23 Correct 25 ms 55900 KB Output is correct
24 Correct 25 ms 55896 KB Output is correct
25 Correct 27 ms 55800 KB Output is correct
26 Correct 24 ms 56412 KB Output is correct
27 Correct 26 ms 56412 KB Output is correct
28 Correct 26 ms 56124 KB Output is correct
29 Correct 25 ms 55900 KB Output is correct
30 Correct 24 ms 55900 KB Output is correct
31 Correct 25 ms 56408 KB Output is correct
32 Correct 25 ms 56264 KB Output is correct
33 Correct 26 ms 56412 KB Output is correct
34 Correct 25 ms 55896 KB Output is correct
35 Correct 24 ms 55940 KB Output is correct
36 Correct 25 ms 55896 KB Output is correct
37 Correct 26 ms 56156 KB Output is correct
38 Correct 26 ms 55900 KB Output is correct
39 Correct 24 ms 55900 KB Output is correct
40 Correct 25 ms 56408 KB Output is correct
41 Correct 26 ms 55896 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 27 ms 55940 KB Output is correct
44 Correct 25 ms 55880 KB Output is correct
45 Correct 25 ms 55900 KB Output is correct
46 Correct 23 ms 55900 KB Output is correct
47 Correct 25 ms 56156 KB Output is correct
48 Correct 25 ms 56000 KB Output is correct
49 Correct 24 ms 55896 KB Output is correct
50 Correct 30 ms 58716 KB Output is correct
51 Correct 29 ms 58244 KB Output is correct
52 Correct 29 ms 58196 KB Output is correct
53 Correct 28 ms 57940 KB Output is correct
54 Correct 27 ms 57180 KB Output is correct
55 Correct 29 ms 59732 KB Output is correct
56 Correct 30 ms 59000 KB Output is correct
57 Correct 29 ms 59228 KB Output is correct
58 Correct 30 ms 55900 KB Output is correct
59 Correct 22 ms 55900 KB Output is correct
60 Correct 22 ms 55896 KB Output is correct
61 Correct 24 ms 56920 KB Output is correct
62 Correct 23 ms 56668 KB Output is correct
63 Correct 23 ms 56156 KB Output is correct
64 Correct 22 ms 55900 KB Output is correct
65 Correct 24 ms 57180 KB Output is correct
66 Correct 21 ms 55900 KB Output is correct
67 Correct 22 ms 55900 KB Output is correct
68 Correct 22 ms 55900 KB Output is correct
69 Correct 22 ms 56188 KB Output is correct
70 Correct 23 ms 56932 KB Output is correct
71 Runtime error 198 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 24 ms 55888 KB Output is correct
2 Correct 24 ms 55900 KB Output is correct
3 Correct 24 ms 55844 KB Output is correct
4 Correct 24 ms 55924 KB Output is correct
5 Correct 24 ms 55876 KB Output is correct
6 Correct 25 ms 55892 KB Output is correct
7 Correct 25 ms 55900 KB Output is correct
8 Correct 25 ms 55780 KB Output is correct
9 Correct 24 ms 55900 KB Output is correct
10 Correct 25 ms 56008 KB Output is correct
11 Correct 26 ms 55900 KB Output is correct
12 Correct 26 ms 55896 KB Output is correct
13 Correct 24 ms 55896 KB Output is correct
14 Correct 23 ms 55928 KB Output is correct
15 Correct 24 ms 55828 KB Output is correct
16 Correct 25 ms 55900 KB Output is correct
17 Correct 24 ms 55900 KB Output is correct
18 Correct 23 ms 55900 KB Output is correct
19 Correct 25 ms 55892 KB Output is correct
20 Correct 25 ms 55900 KB Output is correct
21 Correct 25 ms 55992 KB Output is correct
22 Correct 25 ms 55888 KB Output is correct
23 Correct 25 ms 55900 KB Output is correct
24 Correct 25 ms 55896 KB Output is correct
25 Correct 27 ms 55800 KB Output is correct
26 Correct 24 ms 56412 KB Output is correct
27 Correct 26 ms 56412 KB Output is correct
28 Correct 26 ms 56124 KB Output is correct
29 Correct 25 ms 55900 KB Output is correct
30 Correct 24 ms 55900 KB Output is correct
31 Correct 25 ms 56408 KB Output is correct
32 Correct 25 ms 56264 KB Output is correct
33 Correct 26 ms 56412 KB Output is correct
34 Correct 25 ms 55896 KB Output is correct
35 Correct 24 ms 55940 KB Output is correct
36 Correct 25 ms 55896 KB Output is correct
37 Correct 26 ms 56156 KB Output is correct
38 Correct 26 ms 55900 KB Output is correct
39 Correct 24 ms 55900 KB Output is correct
40 Correct 25 ms 56408 KB Output is correct
41 Correct 26 ms 55896 KB Output is correct
42 Correct 25 ms 55900 KB Output is correct
43 Correct 27 ms 55940 KB Output is correct
44 Correct 25 ms 55880 KB Output is correct
45 Correct 25 ms 55900 KB Output is correct
46 Correct 23 ms 55900 KB Output is correct
47 Correct 25 ms 56156 KB Output is correct
48 Correct 25 ms 56000 KB Output is correct
49 Correct 24 ms 55896 KB Output is correct
50 Correct 30 ms 58716 KB Output is correct
51 Correct 29 ms 58244 KB Output is correct
52 Correct 29 ms 58196 KB Output is correct
53 Correct 28 ms 57940 KB Output is correct
54 Correct 27 ms 57180 KB Output is correct
55 Correct 29 ms 59732 KB Output is correct
56 Correct 30 ms 59000 KB Output is correct
57 Correct 29 ms 59228 KB Output is correct
58 Correct 30 ms 55900 KB Output is correct
59 Correct 22 ms 55900 KB Output is correct
60 Correct 22 ms 55896 KB Output is correct
61 Correct 24 ms 56920 KB Output is correct
62 Correct 23 ms 56668 KB Output is correct
63 Correct 23 ms 56156 KB Output is correct
64 Correct 22 ms 55900 KB Output is correct
65 Correct 24 ms 57180 KB Output is correct
66 Correct 21 ms 55900 KB Output is correct
67 Correct 22 ms 55900 KB Output is correct
68 Correct 22 ms 55900 KB Output is correct
69 Correct 22 ms 56188 KB Output is correct
70 Correct 23 ms 56932 KB Output is correct
71 Runtime error 198 ms 262144 KB Execution killed with signal 9
72 Halted 0 ms 0 KB -