답안 #730207

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
730207 2023-04-25T11:58:39 Z dozer Toys (CEOI18_toy) C++14
100 / 100
362 ms 134144 KB
#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("bmi2,avx2")
using namespace std;
#define sp " "
#define endl "\n";
#define fastio() cin.tie(0), ios_base::sync_with_stdio(0)
#define pb push_back
#define pii pair<int, int>
#define st first
#define nd second
#define N 60005
#define M 3005
#define A 1000000008

const int modulo = 1e9 + 7;

vector<int> dv[M];
int cnt[N];
bitset<N> dp[M];

int32_t main()
{
	fastio();

	int n;
	cin>>n;
	if (n == 1)
	{
		cout<<1<<"\n"<<0<<endl;
		return 0;
	}

	vector<int> v;
	int s = 0;
	for (int i = 1; i * i <= n; i++)
	{
		if (n % i == 0)
		{
			if (i != 1) v.pb(i);
			if (n / i != i) v.pb(n / i);
		}
		s = i;
	}

	sort(v.begin(), v.end());
	int m = v.size();

	for (int i = 0; i < m; i++)
	{
		for (int j = 0; j <= i; j++)
			if (v[i] % v[j] == 0) dv[i].pb(j);
	}

	for (int i = 0; i < m; i++)
	{
		if (v[i] <= s) dp[i][v[i] - 1] = 1;
		for (auto j : dv[i])
			if (j != i) dp[i] |= (dp[j]<<(v[i] / v[j] - 1));
	}

	bitset<A> all;

	for (int i = 0; i < N; i++)
		if (dp[m - 1][i]) all[i] = 1;

	
	for (int it = 0; v[it] < s; it++)
	{
		for (int i = 0; i < N; i++)
			if (dp[it][i]) all[i + n / v[it] - 1] = 1;
	}
	all[n - 1] = 1;

	vector<int> ans;
	int pos = all._Find_first();
	while(pos < A)
	{
		ans.pb(pos);
		pos = all._Find_next(pos);
	}
	cout<<ans.size()<<endl;
	for (auto i : ans)
		cout<<i<<sp;
	cout<<endl;
	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " seconds\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 122696 KB Output is correct
2 Correct 67 ms 122636 KB Output is correct
3 Correct 69 ms 122652 KB Output is correct
4 Correct 76 ms 122708 KB Output is correct
5 Correct 68 ms 122660 KB Output is correct
6 Correct 76 ms 122704 KB Output is correct
7 Correct 67 ms 122588 KB Output is correct
8 Correct 75 ms 122660 KB Output is correct
9 Correct 67 ms 122700 KB Output is correct
10 Correct 70 ms 122628 KB Output is correct
11 Correct 85 ms 122648 KB Output is correct
12 Correct 75 ms 122620 KB Output is correct
13 Correct 78 ms 122704 KB Output is correct
14 Correct 74 ms 122624 KB Output is correct
15 Correct 79 ms 122700 KB Output is correct
16 Correct 69 ms 122616 KB Output is correct
17 Correct 69 ms 122632 KB Output is correct
18 Correct 70 ms 122664 KB Output is correct
19 Correct 69 ms 122616 KB Output is correct
20 Correct 70 ms 122720 KB Output is correct
21 Correct 74 ms 122716 KB Output is correct
22 Correct 70 ms 122668 KB Output is correct
23 Correct 80 ms 122696 KB Output is correct
24 Correct 70 ms 122716 KB Output is correct
25 Correct 75 ms 122692 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 122696 KB Output is correct
2 Correct 67 ms 122636 KB Output is correct
3 Correct 69 ms 122652 KB Output is correct
4 Correct 76 ms 122708 KB Output is correct
5 Correct 68 ms 122660 KB Output is correct
6 Correct 76 ms 122704 KB Output is correct
7 Correct 67 ms 122588 KB Output is correct
8 Correct 75 ms 122660 KB Output is correct
9 Correct 67 ms 122700 KB Output is correct
10 Correct 70 ms 122628 KB Output is correct
11 Correct 85 ms 122648 KB Output is correct
12 Correct 75 ms 122620 KB Output is correct
13 Correct 78 ms 122704 KB Output is correct
14 Correct 74 ms 122624 KB Output is correct
15 Correct 79 ms 122700 KB Output is correct
16 Correct 69 ms 122616 KB Output is correct
17 Correct 69 ms 122632 KB Output is correct
18 Correct 70 ms 122664 KB Output is correct
19 Correct 69 ms 122616 KB Output is correct
20 Correct 70 ms 122720 KB Output is correct
21 Correct 74 ms 122716 KB Output is correct
22 Correct 70 ms 122668 KB Output is correct
23 Correct 80 ms 122696 KB Output is correct
24 Correct 70 ms 122716 KB Output is correct
25 Correct 75 ms 122692 KB Output is correct
26 Correct 69 ms 123116 KB Output is correct
27 Correct 80 ms 123092 KB Output is correct
28 Correct 68 ms 123016 KB Output is correct
29 Correct 72 ms 122904 KB Output is correct
30 Correct 71 ms 122932 KB Output is correct
31 Correct 69 ms 123088 KB Output is correct
32 Correct 70 ms 123084 KB Output is correct
33 Correct 70 ms 123084 KB Output is correct
34 Correct 71 ms 122600 KB Output is correct
35 Correct 69 ms 122640 KB Output is correct
36 Correct 68 ms 122700 KB Output is correct
37 Correct 70 ms 122952 KB Output is correct
38 Correct 85 ms 122832 KB Output is correct
39 Correct 68 ms 122700 KB Output is correct
40 Correct 75 ms 122980 KB Output is correct
41 Correct 69 ms 122636 KB Output is correct
42 Correct 74 ms 122696 KB Output is correct
43 Correct 76 ms 122844 KB Output is correct
44 Correct 83 ms 122596 KB Output is correct
45 Correct 74 ms 122944 KB Output is correct
46 Correct 70 ms 122716 KB Output is correct
47 Correct 71 ms 122948 KB Output is correct
48 Correct 72 ms 122680 KB Output is correct
49 Correct 76 ms 122988 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 122696 KB Output is correct
2 Correct 67 ms 122636 KB Output is correct
3 Correct 69 ms 122652 KB Output is correct
4 Correct 76 ms 122708 KB Output is correct
5 Correct 68 ms 122660 KB Output is correct
6 Correct 76 ms 122704 KB Output is correct
7 Correct 67 ms 122588 KB Output is correct
8 Correct 75 ms 122660 KB Output is correct
9 Correct 67 ms 122700 KB Output is correct
10 Correct 70 ms 122628 KB Output is correct
11 Correct 85 ms 122648 KB Output is correct
12 Correct 75 ms 122620 KB Output is correct
13 Correct 78 ms 122704 KB Output is correct
14 Correct 74 ms 122624 KB Output is correct
15 Correct 79 ms 122700 KB Output is correct
16 Correct 69 ms 122616 KB Output is correct
17 Correct 69 ms 122632 KB Output is correct
18 Correct 70 ms 122664 KB Output is correct
19 Correct 69 ms 122616 KB Output is correct
20 Correct 70 ms 122720 KB Output is correct
21 Correct 74 ms 122716 KB Output is correct
22 Correct 70 ms 122668 KB Output is correct
23 Correct 80 ms 122696 KB Output is correct
24 Correct 70 ms 122716 KB Output is correct
25 Correct 75 ms 122692 KB Output is correct
26 Correct 69 ms 123116 KB Output is correct
27 Correct 80 ms 123092 KB Output is correct
28 Correct 68 ms 123016 KB Output is correct
29 Correct 72 ms 122904 KB Output is correct
30 Correct 71 ms 122932 KB Output is correct
31 Correct 69 ms 123088 KB Output is correct
32 Correct 70 ms 123084 KB Output is correct
33 Correct 70 ms 123084 KB Output is correct
34 Correct 71 ms 122600 KB Output is correct
35 Correct 69 ms 122640 KB Output is correct
36 Correct 68 ms 122700 KB Output is correct
37 Correct 70 ms 122952 KB Output is correct
38 Correct 85 ms 122832 KB Output is correct
39 Correct 68 ms 122700 KB Output is correct
40 Correct 75 ms 122980 KB Output is correct
41 Correct 69 ms 122636 KB Output is correct
42 Correct 74 ms 122696 KB Output is correct
43 Correct 76 ms 122844 KB Output is correct
44 Correct 83 ms 122596 KB Output is correct
45 Correct 74 ms 122944 KB Output is correct
46 Correct 70 ms 122716 KB Output is correct
47 Correct 71 ms 122948 KB Output is correct
48 Correct 72 ms 122680 KB Output is correct
49 Correct 76 ms 122988 KB Output is correct
50 Correct 77 ms 123600 KB Output is correct
51 Correct 74 ms 123500 KB Output is correct
52 Correct 73 ms 123472 KB Output is correct
53 Correct 81 ms 123380 KB Output is correct
54 Correct 70 ms 123516 KB Output is correct
55 Correct 77 ms 123468 KB Output is correct
56 Correct 83 ms 123488 KB Output is correct
57 Correct 74 ms 123472 KB Output is correct
58 Correct 77 ms 122700 KB Output is correct
59 Correct 67 ms 122616 KB Output is correct
60 Correct 73 ms 122700 KB Output is correct
61 Correct 79 ms 123076 KB Output is correct
62 Correct 75 ms 123060 KB Output is correct
63 Correct 69 ms 122952 KB Output is correct
64 Correct 72 ms 122760 KB Output is correct
65 Correct 81 ms 123196 KB Output is correct
66 Correct 71 ms 122796 KB Output is correct
67 Correct 69 ms 122700 KB Output is correct
68 Correct 67 ms 122832 KB Output is correct
69 Correct 70 ms 122952 KB Output is correct
70 Correct 94 ms 123292 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 122696 KB Output is correct
2 Correct 67 ms 122636 KB Output is correct
3 Correct 69 ms 122652 KB Output is correct
4 Correct 76 ms 122708 KB Output is correct
5 Correct 68 ms 122660 KB Output is correct
6 Correct 76 ms 122704 KB Output is correct
7 Correct 67 ms 122588 KB Output is correct
8 Correct 75 ms 122660 KB Output is correct
9 Correct 67 ms 122700 KB Output is correct
10 Correct 70 ms 122628 KB Output is correct
11 Correct 85 ms 122648 KB Output is correct
12 Correct 75 ms 122620 KB Output is correct
13 Correct 78 ms 122704 KB Output is correct
14 Correct 74 ms 122624 KB Output is correct
15 Correct 79 ms 122700 KB Output is correct
16 Correct 69 ms 122616 KB Output is correct
17 Correct 69 ms 122632 KB Output is correct
18 Correct 70 ms 122664 KB Output is correct
19 Correct 69 ms 122616 KB Output is correct
20 Correct 70 ms 122720 KB Output is correct
21 Correct 74 ms 122716 KB Output is correct
22 Correct 70 ms 122668 KB Output is correct
23 Correct 80 ms 122696 KB Output is correct
24 Correct 70 ms 122716 KB Output is correct
25 Correct 75 ms 122692 KB Output is correct
26 Correct 69 ms 123116 KB Output is correct
27 Correct 80 ms 123092 KB Output is correct
28 Correct 68 ms 123016 KB Output is correct
29 Correct 72 ms 122904 KB Output is correct
30 Correct 71 ms 122932 KB Output is correct
31 Correct 69 ms 123088 KB Output is correct
32 Correct 70 ms 123084 KB Output is correct
33 Correct 70 ms 123084 KB Output is correct
34 Correct 71 ms 122600 KB Output is correct
35 Correct 69 ms 122640 KB Output is correct
36 Correct 68 ms 122700 KB Output is correct
37 Correct 70 ms 122952 KB Output is correct
38 Correct 85 ms 122832 KB Output is correct
39 Correct 68 ms 122700 KB Output is correct
40 Correct 75 ms 122980 KB Output is correct
41 Correct 69 ms 122636 KB Output is correct
42 Correct 74 ms 122696 KB Output is correct
43 Correct 76 ms 122844 KB Output is correct
44 Correct 83 ms 122596 KB Output is correct
45 Correct 74 ms 122944 KB Output is correct
46 Correct 70 ms 122716 KB Output is correct
47 Correct 71 ms 122948 KB Output is correct
48 Correct 72 ms 122680 KB Output is correct
49 Correct 76 ms 122988 KB Output is correct
50 Correct 77 ms 123600 KB Output is correct
51 Correct 74 ms 123500 KB Output is correct
52 Correct 73 ms 123472 KB Output is correct
53 Correct 81 ms 123380 KB Output is correct
54 Correct 70 ms 123516 KB Output is correct
55 Correct 77 ms 123468 KB Output is correct
56 Correct 83 ms 123488 KB Output is correct
57 Correct 74 ms 123472 KB Output is correct
58 Correct 77 ms 122700 KB Output is correct
59 Correct 67 ms 122616 KB Output is correct
60 Correct 73 ms 122700 KB Output is correct
61 Correct 79 ms 123076 KB Output is correct
62 Correct 75 ms 123060 KB Output is correct
63 Correct 69 ms 122952 KB Output is correct
64 Correct 72 ms 122760 KB Output is correct
65 Correct 81 ms 123196 KB Output is correct
66 Correct 71 ms 122796 KB Output is correct
67 Correct 69 ms 122700 KB Output is correct
68 Correct 67 ms 122832 KB Output is correct
69 Correct 70 ms 122952 KB Output is correct
70 Correct 94 ms 123292 KB Output is correct
71 Correct 187 ms 128916 KB Output is correct
72 Correct 165 ms 128404 KB Output is correct
73 Correct 177 ms 128060 KB Output is correct
74 Correct 161 ms 127868 KB Output is correct
75 Correct 167 ms 127400 KB Output is correct
76 Correct 224 ms 129016 KB Output is correct
77 Correct 178 ms 127588 KB Output is correct
78 Correct 170 ms 128132 KB Output is correct
79 Correct 159 ms 127872 KB Output is correct
80 Correct 68 ms 122700 KB Output is correct
81 Correct 67 ms 122696 KB Output is correct
82 Correct 85 ms 122828 KB Output is correct
83 Correct 77 ms 123604 KB Output is correct
84 Correct 101 ms 124392 KB Output is correct
85 Correct 83 ms 123248 KB Output is correct
86 Correct 76 ms 123008 KB Output is correct
87 Correct 96 ms 124176 KB Output is correct
88 Correct 73 ms 122732 KB Output is correct
89 Correct 69 ms 122696 KB Output is correct
90 Correct 69 ms 122936 KB Output is correct
91 Correct 93 ms 124480 KB Output is correct
92 Correct 121 ms 127160 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 48 ms 122696 KB Output is correct
2 Correct 67 ms 122636 KB Output is correct
3 Correct 69 ms 122652 KB Output is correct
4 Correct 76 ms 122708 KB Output is correct
5 Correct 68 ms 122660 KB Output is correct
6 Correct 76 ms 122704 KB Output is correct
7 Correct 67 ms 122588 KB Output is correct
8 Correct 75 ms 122660 KB Output is correct
9 Correct 67 ms 122700 KB Output is correct
10 Correct 70 ms 122628 KB Output is correct
11 Correct 85 ms 122648 KB Output is correct
12 Correct 75 ms 122620 KB Output is correct
13 Correct 78 ms 122704 KB Output is correct
14 Correct 74 ms 122624 KB Output is correct
15 Correct 79 ms 122700 KB Output is correct
16 Correct 69 ms 122616 KB Output is correct
17 Correct 69 ms 122632 KB Output is correct
18 Correct 70 ms 122664 KB Output is correct
19 Correct 69 ms 122616 KB Output is correct
20 Correct 70 ms 122720 KB Output is correct
21 Correct 74 ms 122716 KB Output is correct
22 Correct 70 ms 122668 KB Output is correct
23 Correct 80 ms 122696 KB Output is correct
24 Correct 70 ms 122716 KB Output is correct
25 Correct 75 ms 122692 KB Output is correct
26 Correct 69 ms 123116 KB Output is correct
27 Correct 80 ms 123092 KB Output is correct
28 Correct 68 ms 123016 KB Output is correct
29 Correct 72 ms 122904 KB Output is correct
30 Correct 71 ms 122932 KB Output is correct
31 Correct 69 ms 123088 KB Output is correct
32 Correct 70 ms 123084 KB Output is correct
33 Correct 70 ms 123084 KB Output is correct
34 Correct 71 ms 122600 KB Output is correct
35 Correct 69 ms 122640 KB Output is correct
36 Correct 68 ms 122700 KB Output is correct
37 Correct 70 ms 122952 KB Output is correct
38 Correct 85 ms 122832 KB Output is correct
39 Correct 68 ms 122700 KB Output is correct
40 Correct 75 ms 122980 KB Output is correct
41 Correct 69 ms 122636 KB Output is correct
42 Correct 74 ms 122696 KB Output is correct
43 Correct 76 ms 122844 KB Output is correct
44 Correct 83 ms 122596 KB Output is correct
45 Correct 74 ms 122944 KB Output is correct
46 Correct 70 ms 122716 KB Output is correct
47 Correct 71 ms 122948 KB Output is correct
48 Correct 72 ms 122680 KB Output is correct
49 Correct 76 ms 122988 KB Output is correct
50 Correct 77 ms 123600 KB Output is correct
51 Correct 74 ms 123500 KB Output is correct
52 Correct 73 ms 123472 KB Output is correct
53 Correct 81 ms 123380 KB Output is correct
54 Correct 70 ms 123516 KB Output is correct
55 Correct 77 ms 123468 KB Output is correct
56 Correct 83 ms 123488 KB Output is correct
57 Correct 74 ms 123472 KB Output is correct
58 Correct 77 ms 122700 KB Output is correct
59 Correct 67 ms 122616 KB Output is correct
60 Correct 73 ms 122700 KB Output is correct
61 Correct 79 ms 123076 KB Output is correct
62 Correct 75 ms 123060 KB Output is correct
63 Correct 69 ms 122952 KB Output is correct
64 Correct 72 ms 122760 KB Output is correct
65 Correct 81 ms 123196 KB Output is correct
66 Correct 71 ms 122796 KB Output is correct
67 Correct 69 ms 122700 KB Output is correct
68 Correct 67 ms 122832 KB Output is correct
69 Correct 70 ms 122952 KB Output is correct
70 Correct 94 ms 123292 KB Output is correct
71 Correct 187 ms 128916 KB Output is correct
72 Correct 165 ms 128404 KB Output is correct
73 Correct 177 ms 128060 KB Output is correct
74 Correct 161 ms 127868 KB Output is correct
75 Correct 167 ms 127400 KB Output is correct
76 Correct 224 ms 129016 KB Output is correct
77 Correct 178 ms 127588 KB Output is correct
78 Correct 170 ms 128132 KB Output is correct
79 Correct 159 ms 127872 KB Output is correct
80 Correct 68 ms 122700 KB Output is correct
81 Correct 67 ms 122696 KB Output is correct
82 Correct 85 ms 122828 KB Output is correct
83 Correct 77 ms 123604 KB Output is correct
84 Correct 101 ms 124392 KB Output is correct
85 Correct 83 ms 123248 KB Output is correct
86 Correct 76 ms 123008 KB Output is correct
87 Correct 96 ms 124176 KB Output is correct
88 Correct 73 ms 122732 KB Output is correct
89 Correct 69 ms 122696 KB Output is correct
90 Correct 69 ms 122936 KB Output is correct
91 Correct 93 ms 124480 KB Output is correct
92 Correct 121 ms 127160 KB Output is correct
93 Correct 333 ms 134144 KB Output is correct
94 Correct 289 ms 133280 KB Output is correct
95 Correct 276 ms 132760 KB Output is correct
96 Correct 290 ms 132416 KB Output is correct
97 Correct 254 ms 131256 KB Output is correct
98 Correct 322 ms 133656 KB Output is correct
99 Correct 356 ms 133712 KB Output is correct
100 Correct 362 ms 133564 KB Output is correct
101 Correct 270 ms 131472 KB Output is correct
102 Correct 247 ms 130920 KB Output is correct
103 Correct 277 ms 132216 KB Output is correct
104 Correct 74 ms 122664 KB Output is correct
105 Correct 70 ms 122636 KB Output is correct
106 Correct 71 ms 122952 KB Output is correct
107 Correct 84 ms 124076 KB Output is correct
108 Correct 117 ms 125724 KB Output is correct
109 Correct 77 ms 123468 KB Output is correct
110 Correct 78 ms 122732 KB Output is correct
111 Correct 93 ms 124864 KB Output is correct
112 Correct 71 ms 122700 KB Output is correct
113 Correct 72 ms 122672 KB Output is correct
114 Correct 101 ms 124040 KB Output is correct
115 Correct 81 ms 122672 KB Output is correct
116 Correct 93 ms 124024 KB Output is correct
117 Correct 220 ms 130888 KB Output is correct