답안 #1095006

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1095006 2024-10-01T07:11:06 Z alexander707070 Toys (CEOI18_toy) C++14
79 / 100
404 ms 151728 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;
vector<int> res;
vector<int> ans;

unordered_map<int,int> li;
int tim;

void ff(int d,int mins){
	if(mins>d){
		sums[d][mins]={dels[d]-1};
		return;
	}

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

	ff(d,mins+1);
	sums[d][mins]=sums[d][mins+1];
	
	if(dels[d]%dels[mins]==0){
		int x=pos[dels[d]/dels[mins]];
		ff(x,mins);

		tim++;
		for(int i:sums[d][mins])li[i]=tim;

		for(int i:sums[x][mins]){
			if(li[i+dels[mins]-1]==tim)continue;
			li[i+dels[mins]-1]=tim;
			
			sums[d][mins].push_back(i+dels[mins]-1);
		}
	}
}

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;
	}
	
	ff(dels.size()-1,1);
	ans=sums[dels.size()-1][1];

	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:56:15: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |  for(int i=0;i<dels.size();i++){
      |              ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 24152 KB Output is correct
2 Correct 11 ms 24156 KB Output is correct
3 Correct 11 ms 24220 KB Output is correct
4 Correct 12 ms 24156 KB Output is correct
5 Correct 12 ms 24112 KB Output is correct
6 Correct 12 ms 24012 KB Output is correct
7 Correct 10 ms 24156 KB Output is correct
8 Correct 10 ms 24156 KB Output is correct
9 Correct 11 ms 24156 KB Output is correct
10 Correct 11 ms 24156 KB Output is correct
11 Correct 10 ms 24156 KB Output is correct
12 Correct 12 ms 24108 KB Output is correct
13 Correct 12 ms 24152 KB Output is correct
14 Correct 12 ms 24248 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 12 ms 24412 KB Output is correct
17 Correct 11 ms 24156 KB Output is correct
18 Correct 11 ms 24152 KB Output is correct
19 Correct 11 ms 24212 KB Output is correct
20 Correct 11 ms 24156 KB Output is correct
21 Correct 11 ms 24156 KB Output is correct
22 Correct 12 ms 24156 KB Output is correct
23 Correct 10 ms 24156 KB Output is correct
24 Correct 11 ms 24260 KB Output is correct
25 Correct 10 ms 24156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 24152 KB Output is correct
2 Correct 11 ms 24156 KB Output is correct
3 Correct 11 ms 24220 KB Output is correct
4 Correct 12 ms 24156 KB Output is correct
5 Correct 12 ms 24112 KB Output is correct
6 Correct 12 ms 24012 KB Output is correct
7 Correct 10 ms 24156 KB Output is correct
8 Correct 10 ms 24156 KB Output is correct
9 Correct 11 ms 24156 KB Output is correct
10 Correct 11 ms 24156 KB Output is correct
11 Correct 10 ms 24156 KB Output is correct
12 Correct 12 ms 24108 KB Output is correct
13 Correct 12 ms 24152 KB Output is correct
14 Correct 12 ms 24248 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 12 ms 24412 KB Output is correct
17 Correct 11 ms 24156 KB Output is correct
18 Correct 11 ms 24152 KB Output is correct
19 Correct 11 ms 24212 KB Output is correct
20 Correct 11 ms 24156 KB Output is correct
21 Correct 11 ms 24156 KB Output is correct
22 Correct 12 ms 24156 KB Output is correct
23 Correct 10 ms 24156 KB Output is correct
24 Correct 11 ms 24260 KB Output is correct
25 Correct 10 ms 24156 KB Output is correct
26 Correct 13 ms 24364 KB Output is correct
27 Correct 12 ms 24152 KB Output is correct
28 Correct 11 ms 24152 KB Output is correct
29 Correct 10 ms 24156 KB Output is correct
30 Correct 11 ms 24152 KB Output is correct
31 Correct 11 ms 24412 KB Output is correct
32 Correct 11 ms 24264 KB Output is correct
33 Correct 10 ms 24388 KB Output is correct
34 Correct 11 ms 24156 KB Output is correct
35 Correct 11 ms 24156 KB Output is correct
36 Correct 11 ms 24156 KB Output is correct
37 Correct 14 ms 24288 KB Output is correct
38 Correct 10 ms 24156 KB Output is correct
39 Correct 9 ms 24156 KB Output is correct
40 Correct 11 ms 24148 KB Output is correct
41 Correct 12 ms 24156 KB Output is correct
42 Correct 12 ms 24156 KB Output is correct
43 Correct 11 ms 24092 KB Output is correct
44 Correct 12 ms 24156 KB Output is correct
45 Correct 10 ms 24304 KB Output is correct
46 Correct 12 ms 24208 KB Output is correct
47 Correct 11 ms 24156 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 11 ms 24156 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 24152 KB Output is correct
2 Correct 11 ms 24156 KB Output is correct
3 Correct 11 ms 24220 KB Output is correct
4 Correct 12 ms 24156 KB Output is correct
5 Correct 12 ms 24112 KB Output is correct
6 Correct 12 ms 24012 KB Output is correct
7 Correct 10 ms 24156 KB Output is correct
8 Correct 10 ms 24156 KB Output is correct
9 Correct 11 ms 24156 KB Output is correct
10 Correct 11 ms 24156 KB Output is correct
11 Correct 10 ms 24156 KB Output is correct
12 Correct 12 ms 24108 KB Output is correct
13 Correct 12 ms 24152 KB Output is correct
14 Correct 12 ms 24248 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 12 ms 24412 KB Output is correct
17 Correct 11 ms 24156 KB Output is correct
18 Correct 11 ms 24152 KB Output is correct
19 Correct 11 ms 24212 KB Output is correct
20 Correct 11 ms 24156 KB Output is correct
21 Correct 11 ms 24156 KB Output is correct
22 Correct 12 ms 24156 KB Output is correct
23 Correct 10 ms 24156 KB Output is correct
24 Correct 11 ms 24260 KB Output is correct
25 Correct 10 ms 24156 KB Output is correct
26 Correct 13 ms 24364 KB Output is correct
27 Correct 12 ms 24152 KB Output is correct
28 Correct 11 ms 24152 KB Output is correct
29 Correct 10 ms 24156 KB Output is correct
30 Correct 11 ms 24152 KB Output is correct
31 Correct 11 ms 24412 KB Output is correct
32 Correct 11 ms 24264 KB Output is correct
33 Correct 10 ms 24388 KB Output is correct
34 Correct 11 ms 24156 KB Output is correct
35 Correct 11 ms 24156 KB Output is correct
36 Correct 11 ms 24156 KB Output is correct
37 Correct 14 ms 24288 KB Output is correct
38 Correct 10 ms 24156 KB Output is correct
39 Correct 9 ms 24156 KB Output is correct
40 Correct 11 ms 24148 KB Output is correct
41 Correct 12 ms 24156 KB Output is correct
42 Correct 12 ms 24156 KB Output is correct
43 Correct 11 ms 24092 KB Output is correct
44 Correct 12 ms 24156 KB Output is correct
45 Correct 10 ms 24304 KB Output is correct
46 Correct 12 ms 24208 KB Output is correct
47 Correct 11 ms 24156 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 11 ms 24156 KB Output is correct
50 Correct 15 ms 24920 KB Output is correct
51 Correct 11 ms 24920 KB Output is correct
52 Correct 13 ms 24768 KB Output is correct
53 Correct 13 ms 24664 KB Output is correct
54 Correct 11 ms 24412 KB Output is correct
55 Correct 12 ms 25140 KB Output is correct
56 Correct 12 ms 25016 KB Output is correct
57 Correct 12 ms 24924 KB Output is correct
58 Correct 12 ms 24152 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 13 ms 24052 KB Output is correct
61 Correct 11 ms 24412 KB Output is correct
62 Correct 11 ms 24412 KB Output is correct
63 Correct 10 ms 24156 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 11 ms 24408 KB Output is correct
66 Correct 10 ms 24156 KB Output is correct
67 Correct 10 ms 24176 KB Output is correct
68 Correct 10 ms 24168 KB Output is correct
69 Correct 10 ms 24156 KB Output is correct
70 Correct 10 ms 24412 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 24152 KB Output is correct
2 Correct 11 ms 24156 KB Output is correct
3 Correct 11 ms 24220 KB Output is correct
4 Correct 12 ms 24156 KB Output is correct
5 Correct 12 ms 24112 KB Output is correct
6 Correct 12 ms 24012 KB Output is correct
7 Correct 10 ms 24156 KB Output is correct
8 Correct 10 ms 24156 KB Output is correct
9 Correct 11 ms 24156 KB Output is correct
10 Correct 11 ms 24156 KB Output is correct
11 Correct 10 ms 24156 KB Output is correct
12 Correct 12 ms 24108 KB Output is correct
13 Correct 12 ms 24152 KB Output is correct
14 Correct 12 ms 24248 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 12 ms 24412 KB Output is correct
17 Correct 11 ms 24156 KB Output is correct
18 Correct 11 ms 24152 KB Output is correct
19 Correct 11 ms 24212 KB Output is correct
20 Correct 11 ms 24156 KB Output is correct
21 Correct 11 ms 24156 KB Output is correct
22 Correct 12 ms 24156 KB Output is correct
23 Correct 10 ms 24156 KB Output is correct
24 Correct 11 ms 24260 KB Output is correct
25 Correct 10 ms 24156 KB Output is correct
26 Correct 13 ms 24364 KB Output is correct
27 Correct 12 ms 24152 KB Output is correct
28 Correct 11 ms 24152 KB Output is correct
29 Correct 10 ms 24156 KB Output is correct
30 Correct 11 ms 24152 KB Output is correct
31 Correct 11 ms 24412 KB Output is correct
32 Correct 11 ms 24264 KB Output is correct
33 Correct 10 ms 24388 KB Output is correct
34 Correct 11 ms 24156 KB Output is correct
35 Correct 11 ms 24156 KB Output is correct
36 Correct 11 ms 24156 KB Output is correct
37 Correct 14 ms 24288 KB Output is correct
38 Correct 10 ms 24156 KB Output is correct
39 Correct 9 ms 24156 KB Output is correct
40 Correct 11 ms 24148 KB Output is correct
41 Correct 12 ms 24156 KB Output is correct
42 Correct 12 ms 24156 KB Output is correct
43 Correct 11 ms 24092 KB Output is correct
44 Correct 12 ms 24156 KB Output is correct
45 Correct 10 ms 24304 KB Output is correct
46 Correct 12 ms 24208 KB Output is correct
47 Correct 11 ms 24156 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 11 ms 24156 KB Output is correct
50 Correct 15 ms 24920 KB Output is correct
51 Correct 11 ms 24920 KB Output is correct
52 Correct 13 ms 24768 KB Output is correct
53 Correct 13 ms 24664 KB Output is correct
54 Correct 11 ms 24412 KB Output is correct
55 Correct 12 ms 25140 KB Output is correct
56 Correct 12 ms 25016 KB Output is correct
57 Correct 12 ms 24924 KB Output is correct
58 Correct 12 ms 24152 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 13 ms 24052 KB Output is correct
61 Correct 11 ms 24412 KB Output is correct
62 Correct 11 ms 24412 KB Output is correct
63 Correct 10 ms 24156 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 11 ms 24408 KB Output is correct
66 Correct 10 ms 24156 KB Output is correct
67 Correct 10 ms 24176 KB Output is correct
68 Correct 10 ms 24168 KB Output is correct
69 Correct 10 ms 24156 KB Output is correct
70 Correct 10 ms 24412 KB Output is correct
71 Correct 263 ms 124352 KB Output is correct
72 Correct 209 ms 101992 KB Output is correct
73 Correct 215 ms 107180 KB Output is correct
74 Correct 152 ms 81844 KB Output is correct
75 Correct 165 ms 82516 KB Output is correct
76 Correct 404 ms 151728 KB Output is correct
77 Correct 307 ms 115016 KB Output is correct
78 Correct 309 ms 119736 KB Output is correct
79 Correct 267 ms 111120 KB Output is correct
80 Correct 11 ms 24156 KB Output is correct
81 Correct 10 ms 24156 KB Output is correct
82 Correct 12 ms 24412 KB Output is correct
83 Correct 27 ms 28508 KB Output is correct
84 Correct 33 ms 33616 KB Output is correct
85 Correct 15 ms 25532 KB Output is correct
86 Correct 11 ms 24156 KB Output is correct
87 Correct 37 ms 32860 KB Output is correct
88 Correct 12 ms 24156 KB Output is correct
89 Correct 11 ms 24156 KB Output is correct
90 Correct 12 ms 24156 KB Output is correct
91 Correct 21 ms 29020 KB Output is correct
92 Correct 87 ms 59056 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 12 ms 24152 KB Output is correct
2 Correct 11 ms 24156 KB Output is correct
3 Correct 11 ms 24220 KB Output is correct
4 Correct 12 ms 24156 KB Output is correct
5 Correct 12 ms 24112 KB Output is correct
6 Correct 12 ms 24012 KB Output is correct
7 Correct 10 ms 24156 KB Output is correct
8 Correct 10 ms 24156 KB Output is correct
9 Correct 11 ms 24156 KB Output is correct
10 Correct 11 ms 24156 KB Output is correct
11 Correct 10 ms 24156 KB Output is correct
12 Correct 12 ms 24108 KB Output is correct
13 Correct 12 ms 24152 KB Output is correct
14 Correct 12 ms 24248 KB Output is correct
15 Correct 11 ms 24156 KB Output is correct
16 Correct 12 ms 24412 KB Output is correct
17 Correct 11 ms 24156 KB Output is correct
18 Correct 11 ms 24152 KB Output is correct
19 Correct 11 ms 24212 KB Output is correct
20 Correct 11 ms 24156 KB Output is correct
21 Correct 11 ms 24156 KB Output is correct
22 Correct 12 ms 24156 KB Output is correct
23 Correct 10 ms 24156 KB Output is correct
24 Correct 11 ms 24260 KB Output is correct
25 Correct 10 ms 24156 KB Output is correct
26 Correct 13 ms 24364 KB Output is correct
27 Correct 12 ms 24152 KB Output is correct
28 Correct 11 ms 24152 KB Output is correct
29 Correct 10 ms 24156 KB Output is correct
30 Correct 11 ms 24152 KB Output is correct
31 Correct 11 ms 24412 KB Output is correct
32 Correct 11 ms 24264 KB Output is correct
33 Correct 10 ms 24388 KB Output is correct
34 Correct 11 ms 24156 KB Output is correct
35 Correct 11 ms 24156 KB Output is correct
36 Correct 11 ms 24156 KB Output is correct
37 Correct 14 ms 24288 KB Output is correct
38 Correct 10 ms 24156 KB Output is correct
39 Correct 9 ms 24156 KB Output is correct
40 Correct 11 ms 24148 KB Output is correct
41 Correct 12 ms 24156 KB Output is correct
42 Correct 12 ms 24156 KB Output is correct
43 Correct 11 ms 24092 KB Output is correct
44 Correct 12 ms 24156 KB Output is correct
45 Correct 10 ms 24304 KB Output is correct
46 Correct 12 ms 24208 KB Output is correct
47 Correct 11 ms 24156 KB Output is correct
48 Correct 11 ms 24156 KB Output is correct
49 Correct 11 ms 24156 KB Output is correct
50 Correct 15 ms 24920 KB Output is correct
51 Correct 11 ms 24920 KB Output is correct
52 Correct 13 ms 24768 KB Output is correct
53 Correct 13 ms 24664 KB Output is correct
54 Correct 11 ms 24412 KB Output is correct
55 Correct 12 ms 25140 KB Output is correct
56 Correct 12 ms 25016 KB Output is correct
57 Correct 12 ms 24924 KB Output is correct
58 Correct 12 ms 24152 KB Output is correct
59 Correct 10 ms 24156 KB Output is correct
60 Correct 13 ms 24052 KB Output is correct
61 Correct 11 ms 24412 KB Output is correct
62 Correct 11 ms 24412 KB Output is correct
63 Correct 10 ms 24156 KB Output is correct
64 Correct 10 ms 24156 KB Output is correct
65 Correct 11 ms 24408 KB Output is correct
66 Correct 10 ms 24156 KB Output is correct
67 Correct 10 ms 24176 KB Output is correct
68 Correct 10 ms 24168 KB Output is correct
69 Correct 10 ms 24156 KB Output is correct
70 Correct 10 ms 24412 KB Output is correct
71 Correct 263 ms 124352 KB Output is correct
72 Correct 209 ms 101992 KB Output is correct
73 Correct 215 ms 107180 KB Output is correct
74 Correct 152 ms 81844 KB Output is correct
75 Correct 165 ms 82516 KB Output is correct
76 Correct 404 ms 151728 KB Output is correct
77 Correct 307 ms 115016 KB Output is correct
78 Correct 309 ms 119736 KB Output is correct
79 Correct 267 ms 111120 KB Output is correct
80 Correct 11 ms 24156 KB Output is correct
81 Correct 10 ms 24156 KB Output is correct
82 Correct 12 ms 24412 KB Output is correct
83 Correct 27 ms 28508 KB Output is correct
84 Correct 33 ms 33616 KB Output is correct
85 Correct 15 ms 25532 KB Output is correct
86 Correct 11 ms 24156 KB Output is correct
87 Correct 37 ms 32860 KB Output is correct
88 Correct 12 ms 24156 KB Output is correct
89 Correct 11 ms 24156 KB Output is correct
90 Correct 12 ms 24156 KB Output is correct
91 Correct 21 ms 29020 KB Output is correct
92 Correct 87 ms 59056 KB Output is correct
93 Runtime error 25 ms 48988 KB Execution killed with signal 11
94 Halted 0 ms 0 KB -