Submission #490998

# Submission time Handle Problem Language Result Execution time Memory
490998 2021-11-30T03:09:15 Z hohohaha Toys (CEOI18_toy) C++14
100 / 100
955 ms 80132 KB
// #pragma GCC optimize("Ofast")
// #pragma GCC targt("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,avx,avx2,fma")
// #pragma GCC optimize("unroll-loops")

#include "bits/stdc++.h"
// #include <ext/pb_ds/assoc_container.hpp>
// #include <ext/pb_ds/trie_policy.hpp>
// #include <ext/rope>

using namespace std;
// using namespace __gnu_pbds;
// using namespace __gnu_cxx;

#define li long long
#define ld long double
#define ii pair<int, int>
#define vi vector<int> 
#define vvi vector<vi>


#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define pf push_front
#define eb emplace_back
#define em emplace
#define ob pop_back
#define om pop
#define of pop_front

#define fr front
#define bc back

#define fori(i, a, b) for(int i = (int) (a); i <= (int) (b); ++i)
#define ford(i, a, b) for(int i = (int) (a); i >= (int) (b); --i)

#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#define bitc __builtin_popcountll

mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
#define rand rng
#define endl '\n'
#define sp ' '

#define fastio() ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);

void solve();

signed main() {
// freopen("output.out","w",stdout);
//   fastio();
   int tc = 1;
   fori(test, 1, tc) {
      solve();
   }
   return 0;
}

#define int long long
const ld pi = 4 * atan(1.0), eps = 1e-9;

const int maxn = 1e5 + 5; 

int n; 
vi fac; 
vector<unordered_set<int> > List; //[4000]; 


void solve() { 
	cin >> n; 
	fori(i, 1, sqrt(n)) { 
		if(n % i == 0) { 	
			if(n == i * i) fac.eb(i); 
			else { 
				fac.eb(i); 
				fac.eb(n/i);
			}
		}
	}
	List.resize(fac.size()); 
	sort(all(fac)); 
	List[0].em(0); 
	fori(i, 1, fac.size() - 1) { 
		fori(j, 0, i - 1) { 
			if(fac[i] % fac[j] == 0) { 
				int div = fac[i] / fac[j]; 
				for(auto t: List[j]) { 
					List[i].em(t + div - 1); 
				}
			}
		}
	}
	vector<int> last; 
	for(auto t: List.back()) last.eb(t);  
	cout << last.size() << endl;
	sort(all(last)); 
	for(auto t: last) cout << t << sp; 
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 292 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 0 ms 296 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 292 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 292 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 0 ms 296 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 292 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 1 ms 460 KB Output is correct
51 Correct 1 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 412 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 1 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 0 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 292 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 292 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 0 ms 296 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 292 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 1 ms 460 KB Output is correct
51 Correct 1 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 412 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 1 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 0 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 292 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 143 ms 17316 KB Output is correct
72 Correct 86 ms 13120 KB Output is correct
73 Correct 113 ms 15208 KB Output is correct
74 Correct 64 ms 10328 KB Output is correct
75 Correct 81 ms 10996 KB Output is correct
76 Correct 208 ms 22964 KB Output is correct
77 Correct 178 ms 20480 KB Output is correct
78 Correct 154 ms 19108 KB Output is correct
79 Correct 148 ms 18688 KB Output is correct
80 Correct 0 ms 204 KB Output is correct
81 Correct 0 ms 204 KB Output is correct
82 Correct 2 ms 588 KB Output is correct
83 Correct 18 ms 3404 KB Output is correct
84 Correct 21 ms 4068 KB Output is correct
85 Correct 6 ms 1356 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 24 ms 4676 KB Output is correct
88 Correct 0 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 332 KB Output is correct
91 Correct 8 ms 1996 KB Output is correct
92 Correct 32 ms 6224 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 332 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
29 Correct 1 ms 204 KB Output is correct
30 Correct 1 ms 204 KB Output is correct
31 Correct 1 ms 296 KB Output is correct
32 Correct 1 ms 332 KB Output is correct
33 Correct 1 ms 332 KB Output is correct
34 Correct 0 ms 204 KB Output is correct
35 Correct 0 ms 204 KB Output is correct
36 Correct 0 ms 292 KB Output is correct
37 Correct 1 ms 332 KB Output is correct
38 Correct 1 ms 204 KB Output is correct
39 Correct 0 ms 296 KB Output is correct
40 Correct 1 ms 332 KB Output is correct
41 Correct 0 ms 292 KB Output is correct
42 Correct 0 ms 204 KB Output is correct
43 Correct 0 ms 204 KB Output is correct
44 Correct 0 ms 204 KB Output is correct
45 Correct 0 ms 204 KB Output is correct
46 Correct 0 ms 204 KB Output is correct
47 Correct 1 ms 332 KB Output is correct
48 Correct 0 ms 204 KB Output is correct
49 Correct 0 ms 204 KB Output is correct
50 Correct 1 ms 460 KB Output is correct
51 Correct 1 ms 460 KB Output is correct
52 Correct 1 ms 460 KB Output is correct
53 Correct 1 ms 412 KB Output is correct
54 Correct 1 ms 332 KB Output is correct
55 Correct 2 ms 588 KB Output is correct
56 Correct 3 ms 588 KB Output is correct
57 Correct 1 ms 588 KB Output is correct
58 Correct 0 ms 292 KB Output is correct
59 Correct 0 ms 204 KB Output is correct
60 Correct 0 ms 332 KB Output is correct
61 Correct 1 ms 460 KB Output is correct
62 Correct 1 ms 332 KB Output is correct
63 Correct 1 ms 292 KB Output is correct
64 Correct 1 ms 204 KB Output is correct
65 Correct 1 ms 460 KB Output is correct
66 Correct 0 ms 204 KB Output is correct
67 Correct 0 ms 204 KB Output is correct
68 Correct 1 ms 204 KB Output is correct
69 Correct 1 ms 292 KB Output is correct
70 Correct 1 ms 332 KB Output is correct
71 Correct 143 ms 17316 KB Output is correct
72 Correct 86 ms 13120 KB Output is correct
73 Correct 113 ms 15208 KB Output is correct
74 Correct 64 ms 10328 KB Output is correct
75 Correct 81 ms 10996 KB Output is correct
76 Correct 208 ms 22964 KB Output is correct
77 Correct 178 ms 20480 KB Output is correct
78 Correct 154 ms 19108 KB Output is correct
79 Correct 148 ms 18688 KB Output is correct
80 Correct 0 ms 204 KB Output is correct
81 Correct 0 ms 204 KB Output is correct
82 Correct 2 ms 588 KB Output is correct
83 Correct 18 ms 3404 KB Output is correct
84 Correct 21 ms 4068 KB Output is correct
85 Correct 6 ms 1356 KB Output is correct
86 Correct 1 ms 332 KB Output is correct
87 Correct 24 ms 4676 KB Output is correct
88 Correct 0 ms 204 KB Output is correct
89 Correct 1 ms 204 KB Output is correct
90 Correct 1 ms 332 KB Output is correct
91 Correct 8 ms 1996 KB Output is correct
92 Correct 32 ms 6224 KB Output is correct
93 Correct 779 ms 71380 KB Output is correct
94 Correct 444 ms 48272 KB Output is correct
95 Correct 495 ms 50516 KB Output is correct
96 Correct 435 ms 45456 KB Output is correct
97 Correct 415 ms 41812 KB Output is correct
98 Correct 899 ms 79168 KB Output is correct
99 Correct 955 ms 80132 KB Output is correct
100 Correct 871 ms 77464 KB Output is correct
101 Correct 852 ms 71724 KB Output is correct
102 Correct 811 ms 64396 KB Output is correct
103 Correct 666 ms 57800 KB Output is correct
104 Correct 1 ms 204 KB Output is correct
105 Correct 1 ms 204 KB Output is correct
106 Correct 4 ms 808 KB Output is correct
107 Correct 70 ms 8964 KB Output is correct
108 Correct 147 ms 18732 KB Output is correct
109 Correct 14 ms 3020 KB Output is correct
110 Correct 1 ms 204 KB Output is correct
111 Correct 76 ms 11172 KB Output is correct
112 Correct 1 ms 204 KB Output is correct
113 Correct 1 ms 204 KB Output is correct
114 Correct 3 ms 844 KB Output is correct
115 Correct 1 ms 204 KB Output is correct
116 Correct 6 ms 1612 KB Output is correct
117 Correct 163 ms 22956 KB Output is correct