Submission #746501

# Submission time Handle Problem Language Result Execution time Memory
746501 2023-05-22T14:43:42 Z vjudge1 Toys (CEOI18_toy) C++17
100 / 100
1778 ms 87340 KB
#include<bits/stdc++.h>
using namespace std;

int main(){
	ios::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n;
	cin>>n;
	vector<int>fake;
	map<int,int>mp;
	int fn=n;
	for(long long i=1;i*i<=fn;i++){
		if(fn%i==0){
			fake.push_back(i);
			if(i*i!=fn){
				fake.push_back(fn/i);
			}
		}
	}
	sort(fake.begin(),fake.end());
	int sz=(int)fake.size();
	vector<set<int>>st(sz+1);
	vector<vector<int>>allv(sz+1);
	for(int i=1;i<sz;i++){
		for(int j=0;j<sz;j++){
			if(fake[j]%fake[i]==0){
				allv[j].push_back(i);
			}
		}
	}
	for(int i=0;i<sz;i++){
		mp[fake[i]]=i;
	}
	//cout<<"salam"<<endl;
	st[0].insert(0);
	for(int i=1;i<sz;i++){
		//cout<<i<<" "<<fake[i]<<endl;
		for(auto x:allv[i]){
			int z=fake[i]/fake[x];
			int w=mp[z];
			for(auto y:st[w]){
				st[i].insert(fake[x]-1+y);
			}
		}
	}
	int sza=st[sz-1].size();
	cout<<sza<<"\n";
	for(auto x:st[sz-1]){
		cout<<x<<" ";
	}
	cout<<'\n';
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 280 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 328 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 280 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 328 KB Output is correct
50 Correct 3 ms 596 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 3 ms 596 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 2 ms 468 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 280 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 328 KB Output is correct
50 Correct 3 ms 596 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 3 ms 596 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 2 ms 468 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 274 ms 18768 KB Output is correct
72 Correct 174 ms 14340 KB Output is correct
73 Correct 244 ms 16880 KB Output is correct
74 Correct 142 ms 11252 KB Output is correct
75 Correct 202 ms 12016 KB Output is correct
76 Correct 379 ms 25452 KB Output is correct
77 Correct 348 ms 22264 KB Output is correct
78 Correct 314 ms 20852 KB Output is correct
79 Correct 300 ms 20236 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 34 ms 3548 KB Output is correct
84 Correct 64 ms 4364 KB Output is correct
85 Correct 11 ms 1492 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 47 ms 5108 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 15 ms 2152 KB Output is correct
92 Correct 62 ms 6648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
29 Correct 1 ms 340 KB Output is correct
30 Correct 1 ms 212 KB Output is correct
31 Correct 1 ms 352 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 1 ms 212 KB Output is correct
35 Correct 0 ms 212 KB Output is correct
36 Correct 1 ms 212 KB Output is correct
37 Correct 1 ms 340 KB Output is correct
38 Correct 1 ms 212 KB Output is correct
39 Correct 0 ms 212 KB Output is correct
40 Correct 1 ms 340 KB Output is correct
41 Correct 0 ms 212 KB Output is correct
42 Correct 0 ms 212 KB Output is correct
43 Correct 1 ms 280 KB Output is correct
44 Correct 0 ms 212 KB Output is correct
45 Correct 0 ms 212 KB Output is correct
46 Correct 0 ms 212 KB Output is correct
47 Correct 1 ms 340 KB Output is correct
48 Correct 0 ms 212 KB Output is correct
49 Correct 1 ms 328 KB Output is correct
50 Correct 3 ms 596 KB Output is correct
51 Correct 2 ms 468 KB Output is correct
52 Correct 3 ms 596 KB Output is correct
53 Correct 2 ms 468 KB Output is correct
54 Correct 2 ms 468 KB Output is correct
55 Correct 4 ms 596 KB Output is correct
56 Correct 4 ms 596 KB Output is correct
57 Correct 3 ms 596 KB Output is correct
58 Correct 0 ms 212 KB Output is correct
59 Correct 0 ms 212 KB Output is correct
60 Correct 1 ms 340 KB Output is correct
61 Correct 2 ms 468 KB Output is correct
62 Correct 1 ms 340 KB Output is correct
63 Correct 1 ms 340 KB Output is correct
64 Correct 0 ms 212 KB Output is correct
65 Correct 2 ms 468 KB Output is correct
66 Correct 0 ms 212 KB Output is correct
67 Correct 0 ms 212 KB Output is correct
68 Correct 1 ms 212 KB Output is correct
69 Correct 1 ms 340 KB Output is correct
70 Correct 1 ms 340 KB Output is correct
71 Correct 274 ms 18768 KB Output is correct
72 Correct 174 ms 14340 KB Output is correct
73 Correct 244 ms 16880 KB Output is correct
74 Correct 142 ms 11252 KB Output is correct
75 Correct 202 ms 12016 KB Output is correct
76 Correct 379 ms 25452 KB Output is correct
77 Correct 348 ms 22264 KB Output is correct
78 Correct 314 ms 20852 KB Output is correct
79 Correct 300 ms 20236 KB Output is correct
80 Correct 1 ms 212 KB Output is correct
81 Correct 1 ms 212 KB Output is correct
82 Correct 3 ms 596 KB Output is correct
83 Correct 34 ms 3548 KB Output is correct
84 Correct 64 ms 4364 KB Output is correct
85 Correct 11 ms 1492 KB Output is correct
86 Correct 1 ms 340 KB Output is correct
87 Correct 47 ms 5108 KB Output is correct
88 Correct 1 ms 212 KB Output is correct
89 Correct 0 ms 212 KB Output is correct
90 Correct 1 ms 340 KB Output is correct
91 Correct 15 ms 2152 KB Output is correct
92 Correct 62 ms 6648 KB Output is correct
93 Correct 1529 ms 78060 KB Output is correct
94 Correct 864 ms 52664 KB Output is correct
95 Correct 930 ms 55292 KB Output is correct
96 Correct 870 ms 49328 KB Output is correct
97 Correct 762 ms 44860 KB Output is correct
98 Correct 1686 ms 86180 KB Output is correct
99 Correct 1778 ms 87340 KB Output is correct
100 Correct 1648 ms 84060 KB Output is correct
101 Correct 1651 ms 77752 KB Output is correct
102 Correct 1417 ms 69956 KB Output is correct
103 Correct 1157 ms 62888 KB Output is correct
104 Correct 1 ms 212 KB Output is correct
105 Correct 1 ms 212 KB Output is correct
106 Correct 5 ms 852 KB Output is correct
107 Correct 116 ms 9552 KB Output is correct
108 Correct 316 ms 20440 KB Output is correct
109 Correct 27 ms 3156 KB Output is correct
110 Correct 1 ms 284 KB Output is correct
111 Correct 170 ms 12308 KB Output is correct
112 Correct 1 ms 212 KB Output is correct
113 Correct 1 ms 212 KB Output is correct
114 Correct 5 ms 900 KB Output is correct
115 Correct 1 ms 212 KB Output is correct
116 Correct 11 ms 1700 KB Output is correct
117 Correct 312 ms 24840 KB Output is correct