Submission #963427

# Submission time Handle Problem Language Result Execution time Memory
963427 2024-04-15T02:00:11 Z pcc Toys (CEOI18_toy) C++17
79 / 100
664 ms 26016 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 = 1010;

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 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 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 0 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 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 0 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 2 ms 600 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 3 ms 876 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 3 ms 604 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 2 ms 604 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 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 0 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 2 ms 600 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 3 ms 876 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 3 ms 604 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 2 ms 604 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 336 ms 19528 KB Output is correct
72 Correct 220 ms 14936 KB Output is correct
73 Correct 299 ms 17280 KB Output is correct
74 Correct 178 ms 11672 KB Output is correct
75 Correct 182 ms 12648 KB Output is correct
76 Correct 664 ms 26016 KB Output is correct
77 Correct 509 ms 22968 KB Output is correct
78 Correct 482 ms 21800 KB Output is correct
79 Correct 426 ms 21024 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 2 ms 860 KB Output is correct
83 Correct 35 ms 4008 KB Output is correct
84 Correct 48 ms 4776 KB Output is correct
85 Correct 10 ms 1880 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 66 ms 5512 KB Output is correct
88 Correct 1 ms 344 KB Output is correct
89 Correct 1 ms 344 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 15 ms 2548 KB Output is correct
92 Correct 69 ms 7040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 352 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 508 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 344 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 356 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 1 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 0 ms 348 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 348 KB Output is correct
38 Correct 0 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 0 ms 348 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 1 ms 348 KB Output is correct
44 Correct 0 ms 348 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 0 ms 348 KB Output is correct
49 Correct 0 ms 348 KB Output is correct
50 Correct 3 ms 600 KB Output is correct
51 Correct 2 ms 604 KB Output is correct
52 Correct 2 ms 600 KB Output is correct
53 Correct 2 ms 604 KB Output is correct
54 Correct 1 ms 604 KB Output is correct
55 Correct 3 ms 876 KB Output is correct
56 Correct 3 ms 860 KB Output is correct
57 Correct 3 ms 604 KB Output is correct
58 Correct 1 ms 348 KB Output is correct
59 Correct 0 ms 348 KB Output is correct
60 Correct 0 ms 348 KB Output is correct
61 Correct 2 ms 604 KB Output is correct
62 Correct 1 ms 600 KB Output is correct
63 Correct 1 ms 344 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 604 KB Output is correct
66 Correct 1 ms 344 KB Output is correct
67 Correct 0 ms 348 KB Output is correct
68 Correct 1 ms 348 KB Output is correct
69 Correct 1 ms 348 KB Output is correct
70 Correct 1 ms 604 KB Output is correct
71 Correct 336 ms 19528 KB Output is correct
72 Correct 220 ms 14936 KB Output is correct
73 Correct 299 ms 17280 KB Output is correct
74 Correct 178 ms 11672 KB Output is correct
75 Correct 182 ms 12648 KB Output is correct
76 Correct 664 ms 26016 KB Output is correct
77 Correct 509 ms 22968 KB Output is correct
78 Correct 482 ms 21800 KB Output is correct
79 Correct 426 ms 21024 KB Output is correct
80 Correct 0 ms 348 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 2 ms 860 KB Output is correct
83 Correct 35 ms 4008 KB Output is correct
84 Correct 48 ms 4776 KB Output is correct
85 Correct 10 ms 1880 KB Output is correct
86 Correct 1 ms 348 KB Output is correct
87 Correct 66 ms 5512 KB Output is correct
88 Correct 1 ms 344 KB Output is correct
89 Correct 1 ms 344 KB Output is correct
90 Correct 0 ms 344 KB Output is correct
91 Correct 15 ms 2548 KB Output is correct
92 Correct 69 ms 7040 KB Output is correct
93 Runtime error 1 ms 600 KB Execution killed with signal 11
94 Halted 0 ms 0 KB -