Submission #963428

# Submission time Handle Problem Language Result Execution time Memory
963428 2024-04-15T02:00:55 Z pcc Toys (CEOI18_toy) C++17
100 / 100
3095 ms 90232 KB
#include <bits/stdc++.h>
using namespace std;

#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,popcnt,sse4")
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>

const int mxn = 2022;

ll N;
vector<ll> facs;
set<ll> dp[mxn];

int main(){
	ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
	cin>>N;
	if(N == 1){
		cout<<"1\n0\n";
		return 0;
	}
	for(int i = 1;i*i<=N;i++){
		if(N%i == 0){
			facs.push_back(i);
			if(i*i != N)facs.push_back(N/i);
		}
	}
	sort(facs.begin(),facs.end());
	dp[0].insert(0);
	for(int i = 0;i<facs.size();i++){
		for(int j = i+1;j<facs.size();j++){
			if(facs[j]%facs[i] == 0){
				int r = facs[j]/facs[i];
				for(auto &k:dp[i]){
					dp[j].insert(k+(r-1));
				}
			}
		}
	}
	auto ans = dp[facs.size()-1];
	cout<<ans.size()<<'\n';
	for(auto &i:ans)cout<<i<<' ';cout<<'\n';
	return 0;
}

Compilation message

toy.cpp: In function 'int main()':
toy.cpp:34:17: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   34 |  for(int i = 0;i<facs.size();i++){
      |                ~^~~~~~~~~~~~
toy.cpp:35:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |   for(int j = i+1;j<facs.size();j++){
      |                   ~^~~~~~~~~~~~
toy.cpp:46:2: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
   46 |  for(auto &i:ans)cout<<i<<' ';cout<<'\n';
      |  ^~~
toy.cpp:46:31: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
   46 |  for(auto &i:ans)cout<<i<<' ';cout<<'\n';
      |                               ^~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 412 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 412 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 860 KB Output is correct
51 Correct 3 ms 604 KB Output is correct
52 Correct 2 ms 604 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 3 ms 856 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 4 ms 860 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 2 ms 856 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 856 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 412 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 860 KB Output is correct
51 Correct 3 ms 604 KB Output is correct
52 Correct 2 ms 604 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 3 ms 856 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 4 ms 860 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 2 ms 856 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 856 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 339 ms 19544 KB Output is correct
72 Correct 260 ms 14928 KB Output is correct
73 Correct 324 ms 17396 KB Output is correct
74 Correct 159 ms 11860 KB Output is correct
75 Correct 183 ms 12628 KB Output is correct
76 Correct 566 ms 26260 KB Output is correct
77 Correct 536 ms 23188 KB Output is correct
78 Correct 374 ms 21760 KB Output is correct
79 Correct 357 ms 21080 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 2 ms 860 KB Output is correct
83 Correct 39 ms 3924 KB Output is correct
84 Correct 53 ms 4812 KB Output is correct
85 Correct 11 ms 1884 KB Output is correct
86 Correct 1 ms 344 KB Output is correct
87 Correct 72 ms 5632 KB Output is correct
88 Correct 1 ms 344 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 14 ms 2396 KB Output is correct
92 Correct 72 ms 7252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 1 ms 504 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 344 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 1 ms 604 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 600 KB Output is correct
32 Correct 1 ms 604 KB Output is correct
33 Correct 1 ms 604 KB Output is correct
34 Correct 1 ms 348 KB Output is correct
35 Correct 1 ms 344 KB Output is correct
36 Correct 1 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 1 ms 344 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 1 ms 348 KB Output is correct
41 Correct 1 ms 344 KB Output is correct
42 Correct 1 ms 344 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 412 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 860 KB Output is correct
51 Correct 3 ms 604 KB Output is correct
52 Correct 2 ms 604 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 2 ms 604 KB Output is correct
55 Correct 3 ms 856 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 4 ms 860 KB Output is correct
58 Correct 1 ms 344 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 1 ms 344 KB Output is correct
61 Correct 2 ms 856 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 604 KB Output is correct
64 Correct 1 ms 344 KB Output is correct
65 Correct 1 ms 856 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 0 ms 348 KB Output is correct
69 Correct 0 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 339 ms 19544 KB Output is correct
72 Correct 260 ms 14928 KB Output is correct
73 Correct 324 ms 17396 KB Output is correct
74 Correct 159 ms 11860 KB Output is correct
75 Correct 183 ms 12628 KB Output is correct
76 Correct 566 ms 26260 KB Output is correct
77 Correct 536 ms 23188 KB Output is correct
78 Correct 374 ms 21760 KB Output is correct
79 Correct 357 ms 21080 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 2 ms 860 KB Output is correct
83 Correct 39 ms 3924 KB Output is correct
84 Correct 53 ms 4812 KB Output is correct
85 Correct 11 ms 1884 KB Output is correct
86 Correct 1 ms 344 KB Output is correct
87 Correct 72 ms 5632 KB Output is correct
88 Correct 1 ms 344 KB Output is correct
89 Correct 0 ms 344 KB Output is correct
90 Correct 1 ms 348 KB Output is correct
91 Correct 14 ms 2396 KB Output is correct
92 Correct 72 ms 7252 KB Output is correct
93 Correct 2645 ms 80540 KB Output is correct
94 Correct 1501 ms 54836 KB Output is correct
95 Correct 1690 ms 57196 KB Output is correct
96 Correct 1455 ms 51204 KB Output is correct
97 Correct 1260 ms 46568 KB Output is correct
98 Correct 2757 ms 88840 KB Output is correct
99 Correct 3095 ms 90232 KB Output is correct
100 Correct 2912 ms 86796 KB Output is correct
101 Correct 2517 ms 80384 KB Output is correct
102 Correct 2220 ms 72464 KB Output is correct
103 Correct 1777 ms 65360 KB Output is correct
104 Correct 1 ms 344 KB Output is correct
105 Correct 1 ms 348 KB Output is correct
106 Correct 4 ms 1116 KB Output is correct
107 Correct 114 ms 10412 KB Output is correct
108 Correct 355 ms 21840 KB Output is correct
109 Correct 25 ms 3672 KB Output is correct
110 Correct 1 ms 348 KB Output is correct
111 Correct 154 ms 13228 KB Output is correct
112 Correct 1 ms 348 KB Output is correct
113 Correct 1 ms 552 KB Output is correct
114 Correct 4 ms 1112 KB Output is correct
115 Correct 1 ms 348 KB Output is correct
116 Correct 9 ms 2132 KB Output is correct
117 Correct 374 ms 26244 KB Output is correct