답안 #748650

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
748650 2023-05-26T16:54:03 Z mariowong Toys (CEOI18_toy) C++14
100 / 100
765 ms 20716 KB
#include <bits/stdc++.h>
 
using namespace std;
 
int n;
vector <int> fac;
unordered_map <int,vector<int>  > m;
unordered_map <int,int> now;
int main(){
	ios::sync_with_stdio(false);
	cin >> n;
	m.reserve(1000000);
	for (int i=1;i*i<=n;i++){
		if (n%i == 0){
			if (n/i != i) 
			fac.push_back(n/i);
			fac.push_back(i); 
		}
	}
	sort(fac.begin(),fac.end());
	for (int i=0;i<fac.size();i++){
		now.clear(); now[fac[i]-1]=true;
		m[fac[i]].push_back(fac[i]-1);
		for (int j=0;j<i;j++){
			if (fac[i]%fac[j] == 0){
				for (int k=0;k<m[fac[j]].size();k++){
					if (!now[m[fac[j]][k]+fac[i]/fac[j]-1]){
						now[m[fac[j]][k]+fac[i]/fac[j]-1]=true;
						m[fac[i]].push_back(m[fac[j]][k]+fac[i]/fac[j]-1);
					}
				}
			}
		}
	}
	sort(m[n].begin(),m[n].end());
	cout << (int)m[n].size() << "\n";
	for (int i=0;i<m[n].size();i++){
		cout << m[n][i] << " ";
	}
	cout << "\n";
	return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:21:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |  for (int i=0;i<fac.size();i++){
      |               ~^~~~~~~~~~~
toy.cpp:26:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |     for (int k=0;k<m[fac[j]].size();k++){
      |                  ~^~~~~~~~~~~~~~~~~
toy.cpp:37:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |  for (int i=0;i<m[n].size();i++){
      |               ~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8532 KB Output is correct
2 Correct 5 ms 8532 KB Output is correct
3 Correct 5 ms 8532 KB Output is correct
4 Correct 5 ms 8532 KB Output is correct
5 Correct 4 ms 8532 KB Output is correct
6 Correct 5 ms 8556 KB Output is correct
7 Correct 5 ms 8532 KB Output is correct
8 Correct 4 ms 8532 KB Output is correct
9 Correct 5 ms 8532 KB Output is correct
10 Correct 5 ms 8532 KB Output is correct
11 Correct 4 ms 8532 KB Output is correct
12 Correct 5 ms 8532 KB Output is correct
13 Correct 5 ms 8532 KB Output is correct
14 Correct 4 ms 8532 KB Output is correct
15 Correct 5 ms 8532 KB Output is correct
16 Correct 5 ms 8576 KB Output is correct
17 Correct 4 ms 8532 KB Output is correct
18 Correct 4 ms 8532 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 4 ms 8532 KB Output is correct
21 Correct 4 ms 8532 KB Output is correct
22 Correct 5 ms 8532 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 4 ms 8532 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8532 KB Output is correct
2 Correct 5 ms 8532 KB Output is correct
3 Correct 5 ms 8532 KB Output is correct
4 Correct 5 ms 8532 KB Output is correct
5 Correct 4 ms 8532 KB Output is correct
6 Correct 5 ms 8556 KB Output is correct
7 Correct 5 ms 8532 KB Output is correct
8 Correct 4 ms 8532 KB Output is correct
9 Correct 5 ms 8532 KB Output is correct
10 Correct 5 ms 8532 KB Output is correct
11 Correct 4 ms 8532 KB Output is correct
12 Correct 5 ms 8532 KB Output is correct
13 Correct 5 ms 8532 KB Output is correct
14 Correct 4 ms 8532 KB Output is correct
15 Correct 5 ms 8532 KB Output is correct
16 Correct 5 ms 8576 KB Output is correct
17 Correct 4 ms 8532 KB Output is correct
18 Correct 4 ms 8532 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 4 ms 8532 KB Output is correct
21 Correct 4 ms 8532 KB Output is correct
22 Correct 5 ms 8532 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 4 ms 8532 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 4 ms 8512 KB Output is correct
27 Correct 4 ms 8532 KB Output is correct
28 Correct 4 ms 8532 KB Output is correct
29 Correct 5 ms 8532 KB Output is correct
30 Correct 5 ms 8532 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8616 KB Output is correct
33 Correct 5 ms 8516 KB Output is correct
34 Correct 5 ms 8532 KB Output is correct
35 Correct 4 ms 8532 KB Output is correct
36 Correct 4 ms 8532 KB Output is correct
37 Correct 5 ms 8540 KB Output is correct
38 Correct 6 ms 8532 KB Output is correct
39 Correct 5 ms 8512 KB Output is correct
40 Correct 5 ms 8532 KB Output is correct
41 Correct 5 ms 8532 KB Output is correct
42 Correct 5 ms 8532 KB Output is correct
43 Correct 4 ms 8532 KB Output is correct
44 Correct 4 ms 8532 KB Output is correct
45 Correct 5 ms 8532 KB Output is correct
46 Correct 5 ms 8532 KB Output is correct
47 Correct 4 ms 8532 KB Output is correct
48 Correct 4 ms 8532 KB Output is correct
49 Correct 4 ms 8532 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8532 KB Output is correct
2 Correct 5 ms 8532 KB Output is correct
3 Correct 5 ms 8532 KB Output is correct
4 Correct 5 ms 8532 KB Output is correct
5 Correct 4 ms 8532 KB Output is correct
6 Correct 5 ms 8556 KB Output is correct
7 Correct 5 ms 8532 KB Output is correct
8 Correct 4 ms 8532 KB Output is correct
9 Correct 5 ms 8532 KB Output is correct
10 Correct 5 ms 8532 KB Output is correct
11 Correct 4 ms 8532 KB Output is correct
12 Correct 5 ms 8532 KB Output is correct
13 Correct 5 ms 8532 KB Output is correct
14 Correct 4 ms 8532 KB Output is correct
15 Correct 5 ms 8532 KB Output is correct
16 Correct 5 ms 8576 KB Output is correct
17 Correct 4 ms 8532 KB Output is correct
18 Correct 4 ms 8532 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 4 ms 8532 KB Output is correct
21 Correct 4 ms 8532 KB Output is correct
22 Correct 5 ms 8532 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 4 ms 8532 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 4 ms 8512 KB Output is correct
27 Correct 4 ms 8532 KB Output is correct
28 Correct 4 ms 8532 KB Output is correct
29 Correct 5 ms 8532 KB Output is correct
30 Correct 5 ms 8532 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8616 KB Output is correct
33 Correct 5 ms 8516 KB Output is correct
34 Correct 5 ms 8532 KB Output is correct
35 Correct 4 ms 8532 KB Output is correct
36 Correct 4 ms 8532 KB Output is correct
37 Correct 5 ms 8540 KB Output is correct
38 Correct 6 ms 8532 KB Output is correct
39 Correct 5 ms 8512 KB Output is correct
40 Correct 5 ms 8532 KB Output is correct
41 Correct 5 ms 8532 KB Output is correct
42 Correct 5 ms 8532 KB Output is correct
43 Correct 4 ms 8532 KB Output is correct
44 Correct 4 ms 8532 KB Output is correct
45 Correct 5 ms 8532 KB Output is correct
46 Correct 5 ms 8532 KB Output is correct
47 Correct 4 ms 8532 KB Output is correct
48 Correct 4 ms 8532 KB Output is correct
49 Correct 4 ms 8532 KB Output is correct
50 Correct 6 ms 8660 KB Output is correct
51 Correct 5 ms 8644 KB Output is correct
52 Correct 5 ms 8644 KB Output is correct
53 Correct 6 ms 8644 KB Output is correct
54 Correct 5 ms 8640 KB Output is correct
55 Correct 6 ms 8660 KB Output is correct
56 Correct 6 ms 8660 KB Output is correct
57 Correct 6 ms 8660 KB Output is correct
58 Correct 4 ms 8532 KB Output is correct
59 Correct 4 ms 8532 KB Output is correct
60 Correct 5 ms 8532 KB Output is correct
61 Correct 5 ms 8660 KB Output is correct
62 Correct 5 ms 8532 KB Output is correct
63 Correct 5 ms 8516 KB Output is correct
64 Correct 4 ms 8532 KB Output is correct
65 Correct 5 ms 8660 KB Output is correct
66 Correct 5 ms 8532 KB Output is correct
67 Correct 5 ms 8532 KB Output is correct
68 Correct 4 ms 8608 KB Output is correct
69 Correct 4 ms 8532 KB Output is correct
70 Correct 5 ms 8516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8532 KB Output is correct
2 Correct 5 ms 8532 KB Output is correct
3 Correct 5 ms 8532 KB Output is correct
4 Correct 5 ms 8532 KB Output is correct
5 Correct 4 ms 8532 KB Output is correct
6 Correct 5 ms 8556 KB Output is correct
7 Correct 5 ms 8532 KB Output is correct
8 Correct 4 ms 8532 KB Output is correct
9 Correct 5 ms 8532 KB Output is correct
10 Correct 5 ms 8532 KB Output is correct
11 Correct 4 ms 8532 KB Output is correct
12 Correct 5 ms 8532 KB Output is correct
13 Correct 5 ms 8532 KB Output is correct
14 Correct 4 ms 8532 KB Output is correct
15 Correct 5 ms 8532 KB Output is correct
16 Correct 5 ms 8576 KB Output is correct
17 Correct 4 ms 8532 KB Output is correct
18 Correct 4 ms 8532 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 4 ms 8532 KB Output is correct
21 Correct 4 ms 8532 KB Output is correct
22 Correct 5 ms 8532 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 4 ms 8532 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 4 ms 8512 KB Output is correct
27 Correct 4 ms 8532 KB Output is correct
28 Correct 4 ms 8532 KB Output is correct
29 Correct 5 ms 8532 KB Output is correct
30 Correct 5 ms 8532 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8616 KB Output is correct
33 Correct 5 ms 8516 KB Output is correct
34 Correct 5 ms 8532 KB Output is correct
35 Correct 4 ms 8532 KB Output is correct
36 Correct 4 ms 8532 KB Output is correct
37 Correct 5 ms 8540 KB Output is correct
38 Correct 6 ms 8532 KB Output is correct
39 Correct 5 ms 8512 KB Output is correct
40 Correct 5 ms 8532 KB Output is correct
41 Correct 5 ms 8532 KB Output is correct
42 Correct 5 ms 8532 KB Output is correct
43 Correct 4 ms 8532 KB Output is correct
44 Correct 4 ms 8532 KB Output is correct
45 Correct 5 ms 8532 KB Output is correct
46 Correct 5 ms 8532 KB Output is correct
47 Correct 4 ms 8532 KB Output is correct
48 Correct 4 ms 8532 KB Output is correct
49 Correct 4 ms 8532 KB Output is correct
50 Correct 6 ms 8660 KB Output is correct
51 Correct 5 ms 8644 KB Output is correct
52 Correct 5 ms 8644 KB Output is correct
53 Correct 6 ms 8644 KB Output is correct
54 Correct 5 ms 8640 KB Output is correct
55 Correct 6 ms 8660 KB Output is correct
56 Correct 6 ms 8660 KB Output is correct
57 Correct 6 ms 8660 KB Output is correct
58 Correct 4 ms 8532 KB Output is correct
59 Correct 4 ms 8532 KB Output is correct
60 Correct 5 ms 8532 KB Output is correct
61 Correct 5 ms 8660 KB Output is correct
62 Correct 5 ms 8532 KB Output is correct
63 Correct 5 ms 8516 KB Output is correct
64 Correct 4 ms 8532 KB Output is correct
65 Correct 5 ms 8660 KB Output is correct
66 Correct 5 ms 8532 KB Output is correct
67 Correct 5 ms 8532 KB Output is correct
68 Correct 4 ms 8608 KB Output is correct
69 Correct 4 ms 8532 KB Output is correct
70 Correct 5 ms 8516 KB Output is correct
71 Correct 131 ms 11696 KB Output is correct
72 Correct 92 ms 10848 KB Output is correct
73 Correct 119 ms 11160 KB Output is correct
74 Correct 73 ms 10448 KB Output is correct
75 Correct 80 ms 10560 KB Output is correct
76 Correct 189 ms 12520 KB Output is correct
77 Correct 170 ms 11972 KB Output is correct
78 Correct 154 ms 11940 KB Output is correct
79 Correct 153 ms 11996 KB Output is correct
80 Correct 5 ms 8532 KB Output is correct
81 Correct 5 ms 8532 KB Output is correct
82 Correct 6 ms 8648 KB Output is correct
83 Correct 25 ms 9260 KB Output is correct
84 Correct 28 ms 9312 KB Output is correct
85 Correct 10 ms 8916 KB Output is correct
86 Correct 5 ms 8512 KB Output is correct
87 Correct 30 ms 9464 KB Output is correct
88 Correct 4 ms 8532 KB Output is correct
89 Correct 5 ms 8532 KB Output is correct
90 Correct 5 ms 8532 KB Output is correct
91 Correct 13 ms 9076 KB Output is correct
92 Correct 39 ms 9920 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 8532 KB Output is correct
2 Correct 5 ms 8532 KB Output is correct
3 Correct 5 ms 8532 KB Output is correct
4 Correct 5 ms 8532 KB Output is correct
5 Correct 4 ms 8532 KB Output is correct
6 Correct 5 ms 8556 KB Output is correct
7 Correct 5 ms 8532 KB Output is correct
8 Correct 4 ms 8532 KB Output is correct
9 Correct 5 ms 8532 KB Output is correct
10 Correct 5 ms 8532 KB Output is correct
11 Correct 4 ms 8532 KB Output is correct
12 Correct 5 ms 8532 KB Output is correct
13 Correct 5 ms 8532 KB Output is correct
14 Correct 4 ms 8532 KB Output is correct
15 Correct 5 ms 8532 KB Output is correct
16 Correct 5 ms 8576 KB Output is correct
17 Correct 4 ms 8532 KB Output is correct
18 Correct 4 ms 8532 KB Output is correct
19 Correct 5 ms 8532 KB Output is correct
20 Correct 4 ms 8532 KB Output is correct
21 Correct 4 ms 8532 KB Output is correct
22 Correct 5 ms 8532 KB Output is correct
23 Correct 5 ms 8532 KB Output is correct
24 Correct 4 ms 8532 KB Output is correct
25 Correct 5 ms 8532 KB Output is correct
26 Correct 4 ms 8512 KB Output is correct
27 Correct 4 ms 8532 KB Output is correct
28 Correct 4 ms 8532 KB Output is correct
29 Correct 5 ms 8532 KB Output is correct
30 Correct 5 ms 8532 KB Output is correct
31 Correct 5 ms 8536 KB Output is correct
32 Correct 5 ms 8616 KB Output is correct
33 Correct 5 ms 8516 KB Output is correct
34 Correct 5 ms 8532 KB Output is correct
35 Correct 4 ms 8532 KB Output is correct
36 Correct 4 ms 8532 KB Output is correct
37 Correct 5 ms 8540 KB Output is correct
38 Correct 6 ms 8532 KB Output is correct
39 Correct 5 ms 8512 KB Output is correct
40 Correct 5 ms 8532 KB Output is correct
41 Correct 5 ms 8532 KB Output is correct
42 Correct 5 ms 8532 KB Output is correct
43 Correct 4 ms 8532 KB Output is correct
44 Correct 4 ms 8532 KB Output is correct
45 Correct 5 ms 8532 KB Output is correct
46 Correct 5 ms 8532 KB Output is correct
47 Correct 4 ms 8532 KB Output is correct
48 Correct 4 ms 8532 KB Output is correct
49 Correct 4 ms 8532 KB Output is correct
50 Correct 6 ms 8660 KB Output is correct
51 Correct 5 ms 8644 KB Output is correct
52 Correct 5 ms 8644 KB Output is correct
53 Correct 6 ms 8644 KB Output is correct
54 Correct 5 ms 8640 KB Output is correct
55 Correct 6 ms 8660 KB Output is correct
56 Correct 6 ms 8660 KB Output is correct
57 Correct 6 ms 8660 KB Output is correct
58 Correct 4 ms 8532 KB Output is correct
59 Correct 4 ms 8532 KB Output is correct
60 Correct 5 ms 8532 KB Output is correct
61 Correct 5 ms 8660 KB Output is correct
62 Correct 5 ms 8532 KB Output is correct
63 Correct 5 ms 8516 KB Output is correct
64 Correct 4 ms 8532 KB Output is correct
65 Correct 5 ms 8660 KB Output is correct
66 Correct 5 ms 8532 KB Output is correct
67 Correct 5 ms 8532 KB Output is correct
68 Correct 4 ms 8608 KB Output is correct
69 Correct 4 ms 8532 KB Output is correct
70 Correct 5 ms 8516 KB Output is correct
71 Correct 131 ms 11696 KB Output is correct
72 Correct 92 ms 10848 KB Output is correct
73 Correct 119 ms 11160 KB Output is correct
74 Correct 73 ms 10448 KB Output is correct
75 Correct 80 ms 10560 KB Output is correct
76 Correct 189 ms 12520 KB Output is correct
77 Correct 170 ms 11972 KB Output is correct
78 Correct 154 ms 11940 KB Output is correct
79 Correct 153 ms 11996 KB Output is correct
80 Correct 5 ms 8532 KB Output is correct
81 Correct 5 ms 8532 KB Output is correct
82 Correct 6 ms 8648 KB Output is correct
83 Correct 25 ms 9260 KB Output is correct
84 Correct 28 ms 9312 KB Output is correct
85 Correct 10 ms 8916 KB Output is correct
86 Correct 5 ms 8512 KB Output is correct
87 Correct 30 ms 9464 KB Output is correct
88 Correct 4 ms 8532 KB Output is correct
89 Correct 5 ms 8532 KB Output is correct
90 Correct 5 ms 8532 KB Output is correct
91 Correct 13 ms 9076 KB Output is correct
92 Correct 39 ms 9920 KB Output is correct
93 Correct 633 ms 19604 KB Output is correct
94 Correct 377 ms 16556 KB Output is correct
95 Correct 432 ms 16952 KB Output is correct
96 Correct 367 ms 16028 KB Output is correct
97 Correct 337 ms 15400 KB Output is correct
98 Correct 719 ms 20608 KB Output is correct
99 Correct 765 ms 20716 KB Output is correct
100 Correct 708 ms 20336 KB Output is correct
101 Correct 657 ms 19604 KB Output is correct
102 Correct 571 ms 18408 KB Output is correct
103 Correct 468 ms 17760 KB Output is correct
104 Correct 5 ms 8532 KB Output is correct
105 Correct 5 ms 8532 KB Output is correct
106 Correct 8 ms 8788 KB Output is correct
107 Correct 69 ms 10516 KB Output is correct
108 Correct 162 ms 11896 KB Output is correct
109 Correct 21 ms 9172 KB Output is correct
110 Correct 5 ms 8532 KB Output is correct
111 Correct 76 ms 10640 KB Output is correct
112 Correct 5 ms 8476 KB Output is correct
113 Correct 5 ms 8532 KB Output is correct
114 Correct 8 ms 8788 KB Output is correct
115 Correct 5 ms 8532 KB Output is correct
116 Correct 14 ms 8888 KB Output is correct
117 Correct 151 ms 12736 KB Output is correct