Datasets:

Modalities:
Image
Text
Formats:
parquet
Size:
< 1K
Tags:
code
Libraries:
Datasets
pandas
License:
wjomlex commited on
Commit
ff444f7
1 Parent(s): d3f4f72

2023 Problems

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +14 -0
  2. 2023/finals/1050535959425825.jpg +3 -0
  3. 2023/finals/2643202679188960.jpg +3 -0
  4. 2023/finals/320779377496250.jpg +3 -0
  5. 2023/finals/3652000121792782.jpg +3 -0
  6. 2023/finals/365613766120939.jpg +3 -0
  7. 2023/finals/376570394899644.jpg +3 -0
  8. 2023/finals/885100906409208.jpg +3 -0
  9. 2023/finals/cacti_cartography.cpp +264 -0
  10. 2023/finals/cacti_cartography.in +0 -0
  11. 2023/finals/cacti_cartography.md +42 -0
  12. 2023/finals/cacti_cartography.out +64 -0
  13. 2023/finals/cacti_cartography_sol.md +29 -0
  14. 2023/finals/dealing_decks.cpp +153 -0
  15. 2023/finals/dealing_decks.in +83 -0
  16. 2023/finals/dealing_decks.md +66 -0
  17. 2023/finals/dealing_decks.out +41 -0
  18. 2023/finals/dealing_decks_sol.md +22 -0
  19. 2023/finals/nearly_nim.cpp +33 -0
  20. 2023/finals/nearly_nim.in +3 -0
  21. 2023/finals/nearly_nim.md +34 -0
  22. 2023/finals/nearly_nim.out +218 -0
  23. 2023/finals/nearly_nim_sol.md +16 -0
  24. 2023/finals/programming_paths_part_1.cpp +128 -0
  25. 2023/finals/programming_paths_part_1.in +2001 -0
  26. 2023/finals/programming_paths_part_1.md +64 -0
  27. 2023/finals/programming_paths_part_1.out +0 -0
  28. 2023/finals/programming_paths_part_1_sol.md +25 -0
  29. 2023/finals/programming_paths_part_2.cpp +139 -0
  30. 2023/finals/programming_paths_part_2.in +2001 -0
  31. 2023/finals/programming_paths_part_2.md +64 -0
  32. 2023/finals/programming_paths_part_2.out +0 -0
  33. 2023/finals/programming_paths_part_2_sol.md +16 -0
  34. 2023/finals/resisting_robots.cpp +92 -0
  35. 2023/finals/resisting_robots.in +3 -0
  36. 2023/finals/resisting_robots.md +62 -0
  37. 2023/finals/resisting_robots.out +100 -0
  38. 2023/finals/resisting_robots_sol.md +20 -0
  39. 2023/finals/transposing_tiles.cpp +156 -0
  40. 2023/finals/transposing_tiles.in +3 -0
  41. 2023/finals/transposing_tiles.md +31 -0
  42. 2023/finals/transposing_tiles.out +100 -0
  43. 2023/finals/transposing_tiles_sol.md +5 -0
  44. 2023/practice/1367507087507489.jpg +3 -0
  45. 2023/practice/1563872647765708.jpg +3 -0
  46. 2023/practice/181863494933248.jpg +3 -0
  47. 2023/practice/842253013944047.jpg +3 -0
  48. 2023/practice/852013469652032.jpg +3 -0
  49. 2023/practice/903178538089777.jpg +3 -0
  50. 2023/practice/cheeseburger_corollary_ch1.cpp +20 -0
.gitattributes CHANGED
@@ -98,3 +98,17 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
98
  2021/round3/expl-ore-ation_ch3.in filter=lfs diff=lfs merge=lfs -text
99
  2021/round3/perf-ore-mance.in filter=lfs diff=lfs merge=lfs -text
100
  2021/round3/rep-ore-ting.in filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
98
  2021/round3/expl-ore-ation_ch3.in filter=lfs diff=lfs merge=lfs -text
99
  2021/round3/perf-ore-mance.in filter=lfs diff=lfs merge=lfs -text
100
  2021/round3/rep-ore-ting.in filter=lfs diff=lfs merge=lfs -text
101
+ 2023/finals/nearly_nim.in filter=lfs diff=lfs merge=lfs -text
102
+ 2023/finals/resisting_robots.in filter=lfs diff=lfs merge=lfs -text
103
+ 2023/finals/transposing_tiles.in filter=lfs diff=lfs merge=lfs -text
104
+ 2023/practice/road_to_nutella.in filter=lfs diff=lfs merge=lfs -text
105
+ 2023/round1/back_in_black_ch1.in filter=lfs diff=lfs merge=lfs -text
106
+ 2023/round1/back_in_black_ch2.in filter=lfs diff=lfs merge=lfs -text
107
+ 2023/round1/bohemian_rap-sody.in filter=lfs diff=lfs merge=lfs -text
108
+ 2023/round1/today_is_gonna_be_a_great_day.in filter=lfs diff=lfs merge=lfs -text
109
+ 2023/round2/meta_game.in filter=lfs diff=lfs merge=lfs -text
110
+ 2023/round2/ready_go_part_2.in filter=lfs diff=lfs merge=lfs -text
111
+ 2023/round2/tower_rush.in filter=lfs diff=lfs merge=lfs -text
112
+ 2023/round2/wiki_race.in filter=lfs diff=lfs merge=lfs -text
113
+ 2023/round3/double_stars.in filter=lfs diff=lfs merge=lfs -text
114
+ 2023/round3/similar_ships.in filter=lfs diff=lfs merge=lfs -text
2023/finals/1050535959425825.jpg ADDED

Git LFS Details

  • SHA256: d6a6b1d6de8e3b9b5da974bd340c261754af8631ed134bbc6593a1c66fc38ab9
  • Pointer size: 131 Bytes
  • Size of remote file: 363 kB
2023/finals/2643202679188960.jpg ADDED

Git LFS Details

  • SHA256: 0558f6320ae5625ebfcfc658177734071f090aca32b0b1c618117e1b100455d3
  • Pointer size: 130 Bytes
  • Size of remote file: 80.8 kB
2023/finals/320779377496250.jpg ADDED

Git LFS Details

  • SHA256: 388c9ccd3b4c4368d776cd8e0f59a6b90fbc0fef96792869914cd5e97a083fec
  • Pointer size: 131 Bytes
  • Size of remote file: 156 kB
2023/finals/3652000121792782.jpg ADDED

Git LFS Details

  • SHA256: fe9838f8ae68a8ef63c958907b56cd780d723a794376fc87cf74b21da523d866
  • Pointer size: 131 Bytes
  • Size of remote file: 145 kB
2023/finals/365613766120939.jpg ADDED

Git LFS Details

  • SHA256: 46ec5e79dea846f753d2b02145a165cbb38d69972f802a00149afe63d8dfefce
  • Pointer size: 131 Bytes
  • Size of remote file: 171 kB
2023/finals/376570394899644.jpg ADDED

Git LFS Details

  • SHA256: e003be8cf0949f641445238e636c4294cc38594b38994597923307d38ee587f0
  • Pointer size: 130 Bytes
  • Size of remote file: 92.2 kB
2023/finals/885100906409208.jpg ADDED

Git LFS Details

  • SHA256: cd9100f3318b48eb8ba907d3eca08bfb564a6fb456bf245d64dd583231666196
  • Pointer size: 130 Bytes
  • Size of remote file: 80.3 kB
2023/finals/cacti_cartography.cpp ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <cstring>
3
+ #include <iostream>
4
+ #include <map>
5
+ #include <vector>
6
+ using namespace std;
7
+
8
+ typedef long long int64;
9
+
10
+ const int64 kInf = 12345678912345LL;
11
+ const int64 MAXK = 50, KLIM = (MAXK + 1) << 1, NLIM = 1000;
12
+
13
+ int N, M, K;
14
+ vector<int> weights;
15
+ vector<vector<int>> adj;
16
+ int64 f[2][KLIM][KLIM][NLIM];
17
+ int timer;
18
+ vector<int> tin, tout, par;
19
+ vector<int> cycle_ids, cycle_lens, cycle_rev, dist_to_par;
20
+ vector<vector<int>> edge_lnks;
21
+ vector<pair<int, int>> dp_edges;
22
+
23
+ void dfs(int x) {
24
+ tin[x] = timer++;
25
+ for (int y : adj[x]) {
26
+ if (tin[y] != -1) {
27
+ continue;
28
+ }
29
+ dfs(y);
30
+ }
31
+ tout[x] = timer++;
32
+ }
33
+
34
+ int cycle_counter;
35
+ vector<int> dfs_stack;
36
+
37
+ void dfs_cycles(int x, int p) {
38
+ tin[x] = timer++;
39
+ dfs_stack.push_back(x);
40
+ for (int y : adj[x]) {
41
+ if (y == p) {
42
+ continue;
43
+ }
44
+ if (y == par[x]) {
45
+ int cur_len = 1;
46
+ int rev_cycle = -1;
47
+ for (int z = (int)dfs_stack.size() - 1; dfs_stack[z] != par[x]; z--) {
48
+ int edge_id = edge_lnks[dfs_stack[z - 1]][dfs_stack[z]];
49
+ int rev_edge_id = edge_lnks[dfs_stack[z]][dfs_stack[z - 1]];
50
+ if (rev_edge_id != -1 && cycle_ids[rev_edge_id] != -1) {
51
+ rev_cycle = cycle_ids[rev_edge_id];
52
+ cycle_rev[rev_cycle] = cycle_counter;
53
+ }
54
+ cycle_ids[edge_id] = cycle_counter;
55
+ dist_to_par[edge_id] = cur_len++;
56
+ }
57
+ cycle_lens.push_back(cur_len);
58
+ cycle_rev.push_back(rev_cycle);
59
+ cycle_counter++;
60
+ } else {
61
+ if (tin[y] != -1) {
62
+ continue;
63
+ }
64
+ if (edge_lnks[x][y] == -1) {
65
+ edge_lnks[x][y] = dp_edges.size();
66
+ dp_edges.emplace_back(x, y);
67
+ cycle_ids.push_back(-1);
68
+ dist_to_par.push_back(-1);
69
+ }
70
+ dfs_cycles(y, x);
71
+ }
72
+ }
73
+ dfs_stack.pop_back();
74
+ }
75
+
76
+ int lazy_max_dist;
77
+
78
+ int64 lazy_dp(int edge_id, int dist_to_last, int par_dist, int promised) {
79
+ if (dist_to_last > K + 1) {
80
+ promised = 1;
81
+ }
82
+ if (f[promised][dist_to_last][par_dist][edge_id] != -1LL) {
83
+ return f[promised][dist_to_last][par_dist][edge_id];
84
+ }
85
+ const int base_cycle_id = cycle_ids[edge_id];
86
+ if (!dist_to_last && base_cycle_id != -1 &&
87
+ cycle_lens[base_cycle_id] - dist_to_par[edge_id] < par_dist) {
88
+ return f[promised][dist_to_last][par_dist][edge_id] = lazy_dp(
89
+ edge_id, dist_to_last,
90
+ cycle_lens[base_cycle_id] - dist_to_par[edge_id], promised);
91
+ }
92
+ if (!promised && base_cycle_id != -1 &&
93
+ dist_to_par[edge_id] + par_dist < dist_to_last) {
94
+ return f[promised][dist_to_last][par_dist][edge_id] = lazy_dp(
95
+ edge_id, dist_to_par[edge_id] + par_dist, par_dist, promised);
96
+ }
97
+ const int x = dp_edges[edge_id].second;
98
+ int64 res = kInf;
99
+ if (dist_to_last) {
100
+ res = min(res, lazy_dp(edge_id, 0, par_dist, 0) + weights[x]);
101
+ }
102
+ if (dist_to_last == lazy_max_dist) {
103
+ return f[promised][dist_to_last][par_dist][edge_id] = res;
104
+ }
105
+ const int p = dp_edges[edge_id].first;
106
+ vector<int> edge_list;
107
+ vector<pair<int, int>> edge_groups;
108
+ map<int, int> cycle_to_ind;
109
+ for (int y : adj[x]) {
110
+ if (y == p) {
111
+ continue;
112
+ }
113
+ int new_edge_id = edge_lnks[x][y];
114
+ if (new_edge_id == -1) {
115
+ continue;
116
+ }
117
+ int cycle_id = cycle_ids[new_edge_id];
118
+ if (cycle_id != -1) {
119
+ auto mit = cycle_to_ind.find(cycle_id);
120
+ if (mit != cycle_to_ind.end()) {
121
+ edge_groups[mit->second].second = edge_list.size();
122
+ edge_list.push_back(new_edge_id);
123
+ continue;
124
+ }
125
+ }
126
+ int rev_cycle_id = (cycle_id == -1 ? -1 : cycle_rev[cycle_id]);
127
+ cycle_to_ind[rev_cycle_id] = edge_groups.size();
128
+ edge_groups.emplace_back(edge_list.size(), -1);
129
+ edge_list.push_back(new_edge_id);
130
+ }
131
+ const int esz = edge_list.size();
132
+ if (!esz) {
133
+ return f[promised][dist_to_last][par_dist][edge_id] =
134
+ (promised || dist_to_last > K) ? res : 0LL;
135
+ }
136
+ const int egsz = edge_groups.size();
137
+ vector<int64> edge_f(esz), edge_f2(esz);
138
+ for (int new_dist_to_last = dist_to_last + 1, new_promised = promised;
139
+ new_dist_to_last <= lazy_max_dist && res;
140
+ ++new_dist_to_last, new_promised = 1) {
141
+ const int inv_dist_to_last = lazy_max_dist - new_dist_to_last;
142
+ const int min_dist_to_last = min(dist_to_last + 1, 2 + inv_dist_to_last);
143
+ for (int i = 0; i < esz; ++i) {
144
+ const int new_edge_id = edge_list[i];
145
+ const int new_cycle_id = cycle_ids[new_edge_id];
146
+ int new_par_dist = lazy_max_dist;
147
+ if (new_cycle_id != -1) {
148
+ if (new_cycle_id == base_cycle_id) {
149
+ new_par_dist = par_dist;
150
+ new_par_dist =
151
+ min(new_par_dist, 1 + cycle_lens[base_cycle_id] -
152
+ dist_to_par[edge_id] + inv_dist_to_last);
153
+ } else {
154
+ new_par_dist = min_dist_to_last - 1;
155
+ }
156
+ }
157
+ edge_f[i] = lazy_dp(new_edge_id, min_dist_to_last, new_par_dist, 0);
158
+ }
159
+ for (int i = 0; i < esz; i++) {
160
+ const int new_edge_id = edge_list[i];
161
+ const int new_cycle_id = cycle_ids[new_edge_id];
162
+ int new_par_dist = lazy_max_dist;
163
+ if (new_cycle_id != -1) {
164
+ if (new_cycle_id == base_cycle_id) {
165
+ new_par_dist = par_dist;
166
+ } else {
167
+ new_par_dist = dist_to_last;
168
+ }
169
+ }
170
+ edge_f2[i] =
171
+ lazy_dp(new_edge_id, new_dist_to_last, new_par_dist, new_promised);
172
+ }
173
+ int64 f_sum = 0LL, min_diff = kInf;
174
+ for (int i = 0; i < egsz; i++) {
175
+ const int ind1 = edge_groups[i].first;
176
+ int64 edge_group_f = edge_f[ind1], edge_group_f2 = edge_f2[ind1];
177
+ const int ind2 = edge_groups[i].second;
178
+ if (ind2 != -1) {
179
+ edge_group_f = min(edge_group_f, edge_f[ind2]);
180
+ edge_group_f2 = min(edge_group_f2, edge_f2[ind2]);
181
+ }
182
+ min_diff = min(min_diff, edge_group_f2 - edge_group_f);
183
+ f_sum += edge_group_f;
184
+ }
185
+ res = min(res, f_sum + min_diff);
186
+ }
187
+ return f[promised][dist_to_last][par_dist][edge_id] = res;
188
+ }
189
+
190
+ int64 solve() {
191
+ vector<pair<int, int>> edges;
192
+ cin >> N >> M >> K;
193
+ weights.resize(N);
194
+ for (int i = 0; i < N; ++i) {
195
+ cin >> weights[i];
196
+ }
197
+ edges.resize(M);
198
+ for (int i = 0; i < M; ++i) {
199
+ cin >> edges[i].first >> edges[i].second;
200
+ --edges[i].first;
201
+ --edges[i].second;
202
+ }
203
+ int root = N;
204
+ edges.emplace_back(N++, 0);
205
+ M++;
206
+ adj.assign(N, {});
207
+ for (int i = 0; i < M; i++) {
208
+ adj[edges[i].first].push_back(edges[i].second);
209
+ adj[edges[i].second].push_back(edges[i].first);
210
+ }
211
+ timer = 0;
212
+ tin.assign(N, -1);
213
+ tout.resize(N, -1);
214
+ dfs(root);
215
+ vector<int> tin0 = tin, tout0 = tout;
216
+ for (int x = 0; x < N; x++) {
217
+ reverse(adj[x].begin(), adj[x].end());
218
+ }
219
+ timer = 0;
220
+ tin.assign(N, -1);
221
+ tout.resize(N, -1);
222
+ dfs(root);
223
+ par.assign(N, -1);
224
+ for (int x = 0; x < N; x++) {
225
+ for (int y : adj[x]) {
226
+ if (tin0[y] < tin0[x] && tin[y] < tin[x]) {
227
+ par[x] = y;
228
+ }
229
+ }
230
+ }
231
+ cycle_counter = 0;
232
+ dp_edges.clear();
233
+ edge_lnks.assign(N, vector<int>(N, -1));
234
+ cycle_ids.clear();
235
+ cycle_lens.clear();
236
+ cycle_rev.clear();
237
+ dist_to_par.clear();
238
+ timer = 0;
239
+ tin.assign(N, -1);
240
+ dfs_stack.clear();
241
+ dfs_cycles(root, root);
242
+ for (int x = 0; x < N; x++) {
243
+ reverse(adj[x].begin(), adj[x].end());
244
+ }
245
+ timer = 0;
246
+ tin.assign(N, -1);
247
+ dfs_cycles(root, root);
248
+ memset(f, -1, sizeof f);
249
+ lazy_max_dist = ((K + 1) << 1) - 1;
250
+ int64 res = kInf;
251
+ for (int i = 0; i <= K; i++) {
252
+ res = min(res, lazy_dp(edge_lnks[root][0], i + K + 1, lazy_max_dist, 1));
253
+ }
254
+ return res;
255
+ }
256
+
257
+ int main() {
258
+ int T;
259
+ cin >> T;
260
+ for (int t = 1; t <= T; t++) {
261
+ cout << "Case #" << t << ": " << solve() << endl;
262
+ }
263
+ return 0;
264
+ }
2023/finals/cacti_cartography.in ADDED
The diff for this file is too large to render. See raw diff
 
2023/finals/cacti_cartography.md ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Cactus Park is a famous **t**ourist attraction in Sandlandia. It holds \(N\) cactus plants, numbered from \(1\) to \(N\). The cacti are connected by \(M\) bidirectional trails, with trail \(i\) connecting cacti \(A_i\) and \(B_i\).
2
+
3
+ From any cactus, it's always possible to get to any other cactus by taking some sequence of trails. There may be cycles in the park, where a cycle is any sequence of trails that lead from a certain cactus back to itself. The park also has a special property that each trail belongs to at most one simple cycle. In graph theory terms, we can say that the Cactus Park forms a [cactus graph](https://en.wikipedia.org/wiki/Cactus_graph).
4
+
5
+ The park owners want to replace some number of cacti with information kiosks to help guide the tourists. Cutting down cactus \(i\) and building a kiosk there costs the park \(C_i\) dollars. The owners want to build enough kiosks so that the shortest path from every remaining cactus to the closest kiosk does not exceed \(K\) trails. Please help the owners determine the minimum total cost required to satisfy this requirement.
6
+
7
+ # Constraints
8
+
9
+ \(1 \le T \le 65\)
10
+ \(1 \le N \le 500\)
11
+ \(1 \le K \le \min(N, 50)\)
12
+ \(1 \le A_i, B_i \le N\)
13
+ \(A_i \ne B_i\)
14
+ \(1 \le C_i \le 10^9\)
15
+
16
+ Each unordered pair \((A_i, B_i)\) appears at most once in a given test case.
17
+
18
+ # Input Format
19
+
20
+ Input begins with a single integer \(T\), the number of test cases. For each case, there is first a line containing three integers \(N\), \(M\), and \(K\). Then, there is a line containing \(N\) integers \(C_{1..N}\). Then, \(M\) lines follow, the \(i\)th of which contains two integers \(A_i\) and \(B_i\).
21
+
22
+ # Output Format
23
+
24
+ For the \(i\)th case, output `"Case #i: "`, followed by a single integer, the minimum total cost in dollars to satisfy the park owners' requirement.
25
+
26
+ # Sample Explanation
27
+
28
+ The first case is depicted below. Replacing just cactus \(2\) would meet the requirement, but would cost \(\$10\). Instead we can replace cacti \(1\) and \(4\) for a total cost of \(\$8\).
29
+
30
+ {{PHOTO_ID:885100906409208|WIDTH:350}}
31
+
32
+ The second case is depicted below. One solution is to replace cacti \(1\) and \(4\) for a total cost of \(\$6\).
33
+
34
+ {{PHOTO_ID:3652000121792782|WIDTH:500}}
35
+
36
+ In the third case, all the cactuses are already within \(2\) trails of each other, so we just need a single kiosk anywhere. We should cut down the cheapest cactus, cactus \(1\).
37
+
38
+ {{PHOTO_ID:2643202679188960|WIDTH:350}}
39
+
40
+ In the fourth case, we can cut down cacti \(1\), \(3\), and \(6\) for a total cost of \(9 + 3 + 4 = \$16\)
41
+
42
+ {{PHOTO_ID:365613766120939|WIDTH:500}}
2023/finals/cacti_cartography.out ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 8
2
+ Case #2: 6
3
+ Case #3: 1
4
+ Case #4: 16
5
+ Case #5: 3
6
+ Case #6: 3
7
+ Case #7: 2
8
+ Case #8: 6
9
+ Case #9: 2
10
+ Case #10: 2
11
+ Case #11: 6
12
+ Case #12: 14
13
+ Case #13: 2
14
+ Case #14: 6119234639
15
+ Case #15: 56915
16
+ Case #16: 25737
17
+ Case #17: 134345
18
+ Case #18: 964947
19
+ Case #19: 5007281
20
+ Case #20: 291325
21
+ Case #21: 1218092
22
+ Case #22: 629219
23
+ Case #23: 4921721
24
+ Case #24: 223153307
25
+ Case #25: 25668763120
26
+ Case #26: 51949941040
27
+ Case #27: 27097218102
28
+ Case #28: 11054755671
29
+ Case #29: 6223777469
30
+ Case #30: 54339322140
31
+ Case #31: 26401761341
32
+ Case #32: 19580701903
33
+ Case #33: 1908941214
34
+ Case #34: 129619921
35
+ Case #35: 80362051
36
+ Case #36: 71755108
37
+ Case #37: 188221638
38
+ Case #38: 529801
39
+ Case #39: 4131584
40
+ Case #40: 19427941
41
+ Case #41: 4573302
42
+ Case #42: 45624427
43
+ Case #43: 518482
44
+ Case #44: 5
45
+ Case #45: 2959
46
+ Case #46: 13016
47
+ Case #47: 119515
48
+ Case #48: 735039570
49
+ Case #49: 1799334197
50
+ Case #50: 1837451412
51
+ Case #51: 4070204431
52
+ Case #52: 559773182
53
+ Case #53: 865289571
54
+ Case #54: 2218966827
55
+ Case #55: 211
56
+ Case #56: 4080
57
+ Case #57: 27316
58
+ Case #58: 282265375
59
+ Case #59: 454432246
60
+ Case #60: 6059130
61
+ Case #61: 15476397
62
+ Case #62: 4795686
63
+ Case #63: 21325610
64
+ Case #64: 74321936
2023/finals/cacti_cartography_sol.md ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ To solve this problem, let’s preprocess the input first. We'll store the input cactus graph in an adjacency list. Let’s pick any random starting vertex \(s\) from which to perform a DFS traversal, storing the pre- and post-visiting times for each vertex \(v\) as \(tin[v]\) and \(tout[v]\) respectively.
2
+
3
+ After reversing the adjacency list for each vertex, let’s repeat the DFS from the vertex \(s\) (we'll consider all adjacent vertices in reverse order this time) and store the pre- and post-visiting times for each vertex \(v\) as \(tin'[v]\) and \(tout'[v]\) respectively. Using DFS and pre/post visiting times for every edge \(u \to v\), we can determine the following:
4
+
5
+ * Whether this edge is the first or the last in its cycle when traversing the cactus starting from \(s\)
6
+ * If \(tin[v] < tin[u]\) and \(tin'[v] < tin'[u]\), then this edge is the last of the cycle and vertex \(v\) is always the first vertex of the cycle visited on the way from vertex \(s\). Let’s denote such a vertex as a root of a cycle. Likewise, we can determine the first edge of the cycle.
7
+ * The index of the cycle this edge belongs to (or \(-1\) if it doesn’t belong to any cycle)
8
+ * This can be done in one DFS from vertex \(s\) with an additional stack to recover the path from the first cycle’s vertex to itself.
9
+
10
+ With an additional DFS traversal from vertex \(s\), we can determine the length of each cycle and the distance from each vertex to the root of the cycle it belongs to.
11
+
12
+ For our solution, we will consider all edges as directed, in order of traversal from the starting vertex \(s\). Note that for simplicity, we can consider different traversal orders of the same cycle as two different cycles (but we'll need to mark them as interchangeable). Let’s define \(dp(e, dist1, dist2, mandatory)\), where:
13
+
14
+ * \(e\) – edge ID that uniquely identifies the start \(u\) and end \(v\) of the edge;
15
+ * \(dist1\) – distance between vertex \(v\) and the closest already placed kiosk;
16
+ * \(dist2\) – distance between vertex \(v\) and the cycle root (if edge \(e\) belongs to a cycle);
17
+ * \(mandatory\) – flag for whether we must place a kiosk in this or one of the following DP states.
18
+
19
+ The number of edges \(M\) in a cactus graph of size \(N\) is at most \(3N / 2\). Any valid distance can be up to \((2K + 1) - K\) edges from the previous kiosk, plus \(1\) edge, plus \(K\) edges to the next kiosk. The flag can take on two values, so the total number of states is approximately \(3N * (2K + 1)^2\). In addition, we can force all states with \(dist1 > K + 1\) to have \(mandatory = 1\).
20
+
21
+ For convenience, we can create a dummy edge from dummy vertex \(d\) to \(s\) and use this edge as a starting edge \(e_0\). The answer to the problem is the minimum \(dp(e_0, d1, x, 1)\) across all \(d_1\) from \(K\) to \(2K + 1\). Here, \(x\) denotes any value representing edge belonging to no cycle.
22
+
23
+ The transitions that need to be considered are the following:
24
+
25
+ 1. Build a kiosk at vertex \(v\).
26
+ 2. If \(dist1 < 2K + 1\), keep transitioning to the next edge without building a kiosk at \(v\). For each edge, the value of \(dist'\) will simply be \(dist1 + 1\).
27
+ 3. For exactly one adjacent edge, set a new strict value of \(dist1'\) that's greater than the current \(dist1 + 1\) (set \(mandatory = 1\) for this edge). This is equal to moving the next kiosk closer to the current edge. For other edges, recompute the value of \(dist1'\) considering the kiosk at the selected edge (\(mandatory = 0\) for all such edges). This can be done in \(\mathcal{O}(K)\) by iterating over all possible values of the new \(dist1\).
28
+
29
+ As previously mentioned, the total number of states is \(\mathcal{O}(NK^2)\). Each state has \(\mathcal{O}(K)\) transitions, so the total complexity of the solution is \(\mathcal{O}(NK^3)\).
2023/finals/dealing_decks.cpp ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <iostream>
3
+ #include <vector>
4
+ using namespace std;
5
+
6
+ const int kBitCount = 22;
7
+
8
+ class PersistentTrie {
9
+ vector<int> roots, last, last_rec;
10
+ vector<vector<int>> nodes;
11
+
12
+ inline int get_root(int ind) {
13
+ return ind == -1 ? 0 : roots[ind];
14
+ }
15
+
16
+ vector<int> get_bits(int val) {
17
+ vector<int> bits(kBitCount, 0);
18
+ for (int i = 0; i < kBitCount; i++) {
19
+ if (val & (1 << i)) {
20
+ bits[kBitCount - i - 1] = 1;
21
+ }
22
+ }
23
+ return bits;
24
+ }
25
+
26
+ public:
27
+ void reset(int n) {
28
+ last.assign(1, -1);
29
+ last_rec.assign(1, -1);
30
+ nodes.assign(2, vector<int>(1, -1));
31
+ roots.clear();
32
+ roots.reserve(n + 1);
33
+ last.reserve((n + 1) * (kBitCount + 1));
34
+ last_rec.reserve((n + 1) * (kBitCount + 1));
35
+ nodes[0].reserve((n + 1) * (kBitCount + 1));
36
+ nodes[1].reserve((n + 1) * (kBitCount + 1));
37
+ }
38
+
39
+ void add(int val, int ind) {
40
+ vector<int> bits = get_bits(val);
41
+ int r = roots.size(), node_id = nodes[0].size();
42
+ roots.push_back(node_id);
43
+ int root_id = get_root(r - 1);
44
+ nodes[0].push_back(nodes[0][root_id]);
45
+ nodes[1].push_back(nodes[1][root_id]);
46
+ last.push_back(ind);
47
+ vector<int> visited_nodes(1, node_id);
48
+ visited_nodes.reserve(kBitCount + 1);
49
+ for (int i = 0; i < kBitCount; ++i) {
50
+ int next_node_id = nodes[bits[i]][node_id];
51
+ if (next_node_id == -1) {
52
+ nodes[0].push_back(-1);
53
+ nodes[1].push_back(-1);
54
+ } else {
55
+ nodes[0].push_back(nodes[0][next_node_id]);
56
+ nodes[1].push_back(nodes[1][next_node_id]);
57
+ }
58
+ last.push_back(ind);
59
+ next_node_id = (int)nodes[0].size() - 1;
60
+ nodes[bits[i]][node_id] = next_node_id;
61
+ node_id = next_node_id;
62
+ visited_nodes.push_back(node_id);
63
+ }
64
+ last_rec.resize(last.size());
65
+ last_rec[visited_nodes.back()] = last[visited_nodes.back()];
66
+ for (int i = (int)visited_nodes.size() - 2; i >= 0; i--) {
67
+ const int node_id = visited_nodes[i];
68
+ last_rec[node_id] = last[node_id];
69
+ for (int j = 0; j < 2; ++j) {
70
+ const int child_node_id = nodes[j][node_id];
71
+ if (child_node_id == -1) {
72
+ last_rec[node_id] = -1;
73
+ } else {
74
+ last_rec[node_id] = min(last_rec[node_id], last_rec[child_node_id]);
75
+ }
76
+ }
77
+ }
78
+ }
79
+
80
+ int get_mex(int l, int r, int val) {
81
+ if (!r) {
82
+ return val ? 0 : 1;
83
+ }
84
+ int res = 0;
85
+ vector<int> bits = get_bits(val);
86
+ int node_id = get_root(r);
87
+ for (int i = 0; i < kBitCount; ++i) {
88
+ if (node_id == -1) {
89
+ break;
90
+ }
91
+ for (int j = 0; j < 2; ++j) {
92
+ const int bit_val = bits[i] ^ j;
93
+ const int child_node_id = nodes[bit_val][node_id];
94
+ if (child_node_id == -1) {
95
+ node_id = child_node_id;
96
+ res |= (j << (kBitCount - i - 1));
97
+ break;
98
+ }
99
+ if (last_rec[child_node_id] < l) {
100
+ node_id = child_node_id;
101
+ res |= (j << (kBitCount - i - 1));
102
+ break;
103
+ }
104
+ }
105
+ }
106
+ return res;
107
+ }
108
+ };
109
+
110
+ PersistentTrie trie;
111
+
112
+ long long solve() {
113
+ int N, x1, y1, z1, x2, y2, z2, x3, y3, z3;
114
+ cin >> N >> x1 >> y1 >> z1 >> x2 >> y2 >> z2 >> x3 >> y3 >> z3;
115
+ vector<int> A(N), B(N), C(N);
116
+ long long pa = 0LL, pb = 0LL, pc = 0LL;
117
+ for (int i = 0; i < N; i++) {
118
+ pa = (pa * x1 + y1) % z1;
119
+ pb = (pb * x2 + y2) % z2;
120
+ pc = (pc * x3 + y3) % z3;
121
+ A[i] = min(i + 1, (int)(1 + pa));
122
+ B[i] = max(A[i], (int)(i + 1 - pb));
123
+ C[i] = min(i, (int)pc);
124
+ }
125
+ A.insert(A.begin(), 0);
126
+ B.insert(B.begin(), 0);
127
+ C.insert(C.begin(), 0);
128
+ trie.reset(N);
129
+ trie.add(0, 0);
130
+ vector<int> f(N + 1, 0);
131
+ for (int i = 1; i <= N; ++i) {
132
+ f[i] = trie.get_mex(i - B[i], i - A[i], f[C[i]]);
133
+ trie.add(f[i], i);
134
+ }
135
+ vector<int> lnk(1 << kBitCount, -1);
136
+ long long ans = 0LL;
137
+ for (int i = 1; i <= N; i++) {
138
+ if (lnk[f[i]] == -1) {
139
+ lnk[f[i]] = i;
140
+ }
141
+ ans += lnk[f[i]];
142
+ }
143
+ return ans;
144
+ }
145
+
146
+ int main() {
147
+ int T;
148
+ cin >> T;
149
+ for (int t = 1; t <= T; t++) {
150
+ cout << "Case #" << t << ": " << solve() << endl;
151
+ }
152
+ return 0;
153
+ }
2023/finals/dealing_decks.in ADDED
@@ -0,0 +1,83 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 41
2
+ 4
3
+ 25 30 2 45 16 4 7 26 4
4
+ 2
5
+ 19 48 2 38 23 2 43 31 2
6
+ 3
7
+ 9 17 2 23 42 2 21 43 2
8
+ 8
9
+ 23 5 8 14 22 2 29 28 6
10
+ 10
11
+ 559 556 7 174 424 10 16 605 6
12
+ 21
13
+ 875 456 11 177 442 7 772 631 18
14
+ 1103
15
+ 583 198 169 273 38 1037 65 714 134
16
+ 55062
17
+ 11 440 253 980 931 23119 526 733 20036
18
+ 1999999
19
+ 820049480 21547108 154 708675718 561447936 206 440133487 35313866 34
20
+ 1
21
+ 618469191 790824851 1 240496554 254321196 1 312956711 468952046 1
22
+ 5
23
+ 927221256 311785085 4 698772477 828422337 5 866165702 648272273 4
24
+ 1337
25
+ 617141389 96776754 2 686400226 46429892 7 356199465 607467260 14
26
+ 12345
27
+ 569835284 592019409 199 308489576 551741746 10418 947160134 417058699 6439
28
+ 4096
29
+ 882524217 62432131 34 236089651 201946473 45 537291505 89572094 5
30
+ 892157
31
+ 577513866 796928263 771534 76072296 794292101 759123 90769926 295213615 887741
32
+ 129383
33
+ 55887595 852438620 4710 11626302 775207609 45712 232088575 882360267 13825
34
+ 598778
35
+ 791123555 342313502 32777 967631394 880141999 185599 436295146 96309736 567626
36
+ 228666
37
+ 658441187 230758690 120 479708637 602412993 518 416379589 235508522 27
38
+ 2000000
39
+ 304835691 270438667 11 48760594 766490554 66 92190961 556228743 51404
40
+ 2000000
41
+ 760910031 349756326 37 815146995 377343946 3 80923234 719628481 63457
42
+ 2000000
43
+ 46554619 759417219 6 286810816 476063838 16 595057130 293823025 59916
44
+ 2000000
45
+ 428975320 685583455 224 272112290 398556761 906 724586127 532236124 129507
46
+ 2000000
47
+ 967113756 124639790 1408 957828016 678030194 2770 893015681 944303456 16856
48
+ 2000000
49
+ 250334415 450031626 6642 174619518 13055349 1843 287114316 927515975 181446
50
+ 2000000
51
+ 655903009 521273984 1100 897440710 153838214 8551 579642952 73254666 3503
52
+ 2000000
53
+ 156091746 356425229 2 585640195 937186358 2 25921154 510616709 357945
54
+ 2000000
55
+ 913503456 684954361 2 367054298 154030427 8 165631888 429296876 2784
56
+ 2000000
57
+ 677701956 30977645 4 128803728 140723514 5 373865765 817723005 171076
58
+ 2000000
59
+ 143439592 751027513 16 638841930 391044282 48 693880917 13330581 47560
60
+ 2000000
61
+ 645579553 961124399 31 259538748 321412351 24 597864072 18435563 43776
62
+ 2000000
63
+ 825220632 33752892 14808 650864364 588629702 16626 943286494 884784276 43
64
+ 2000000
65
+ 899879843 346157252 17835 314088427 369371457 11163 698921857 44084703 85
66
+ 2000000
67
+ 546528449 716067318 19032 85451517 664553217 11844 599650529 185668726 76
68
+ 2000000
69
+ 122651508 612555608 2132 416210921 695672740 1684 79592485 621545086 262
70
+ 2000000
71
+ 173746740 376661032 1309 927290494 475468151 2142 990050399 866720809 900
72
+ 2000000
73
+ 187335289 126137493 2034 809840311 27714063 2214 200677041 22664069 964
74
+ 2000000
75
+ 458070904 861770805 1 954595222 31552611 9 137186971 96946491 6
76
+ 2000000
77
+ 556126019 961152783 1 25621302 120476508 7 852896597 179745248 4
78
+ 2000000
79
+ 807322230 863021058 2 58915834 794401121 10 786881443 912097469 2
80
+ 2000000
81
+ 98872432 389583618 7 594840985 956041304 8 794849422 685934408 3
82
+ 2000000
83
+ 34828790 251904740 5 717276352 437920647 2 644744908 25169188 4
2023/finals/dealing_decks.md ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Alice and Bob like to play cards on their lunch break. Their favorite card game starts with two decks on the table containing \(K_1\) and \(K_2\) cards. Players take turns, with Alice going first. Each turn is in two parts:
2
+
3
+ 1. The player selects a deck of cards from the table. Let \(k\) be the number of cards in that deck. They then remove somewhere between \(A_k\) and \(B_k\) \((1 \le A_k \le B_k \le k)\), inclusive, cards from this deck.
4
+ 2. The player then puts a new deck of exactly \(C_k\) \((0 \le C_k < k)\) cards on the table. Here, \(C_k = 0\) means no deck is added.
5
+
6
+ The player who takes the last card wins.
7
+
8
+ For each possible value of \(K_1\) from \(1\) to a given value \(N\), find the minimum possible value of \(K_2\) so that Bob wins the game if both players play optimally. If there is no such \(K_2\) between \(1\) and \(N\), then \(K_2 = -1\). Output the sum of \(K_2\) across every \(K_1 = 1..N\).
9
+
10
+ To reduce the input size, you will not be given \(A_{1..N}\), \(B_{1..N}\), and \(C_{1..N}\) directly. You must instead generate them using parameters \(X_a\), \(Y_a\), \(Z_a\), \(X_b\), \(Y_b\), \(Z_b\), \(X_c\), \(Y_c\), and \(Z_c\) and the algorithm below:
11
+
12
+ \(P_a[0] := 0\)
13
+ \(P_b[0] := 0\)
14
+ \(P_c[0] := 0\)
15
+ \(\text{for each } i := 1..N\):
16
+ \(\;\;\;\;\; P_a[i] := (P_a[i - 1] * X_a + Y_a) \text{ mod } Z_a\)
17
+ \(\;\;\;\;\; P_b[i] := (P_b[i - 1] * X_b + Y_b) \text{ mod } Z_b\)
18
+ \(\;\;\;\;\; P_c[i] := (P_c[i - 1] * X_c + Y_c) \text{ mod } Z_c\)
19
+ \(\;\;\;\;\; A[i] := \min(i, 1 + P_a[i])\)
20
+ \(\;\;\;\;\; B[i] := \max(A[i], i - P_b[i])\)
21
+ \(\;\;\;\;\; C[i] := \min(i - 1, P_c[i])\)
22
+
23
+ Note that for any \(i\), the algorithm guarantees \(1 \le A_i \le B_i \le i\) and \(0 \le C_i < i\).
24
+
25
+ # Constraints
26
+
27
+ \(1 \le T \le 45\)
28
+ \(1 \le N \le 2{,}000{,}000\)
29
+ \(1 \le X_a, Y_a, X_b, Y_b, X_c, Y_c \le 1{,}000{,}000{,}000\)
30
+ \(1 \le Z_a, Z_b, Z_c \le N\)
31
+
32
+ The sum of \(N\) across all test cases is at most \(50{,}000{,}000\).
33
+
34
+ # Input Format
35
+
36
+ Input begins with a single integer \(T\), the number of test cases. For each case, first there is a line containing a single integer \(N\). Then, there is a line containing integers \(X_a\), \(Y_a\), \(Z_a\), \(X_b\), \(Y_b\), \(Z_b\), \(X_c\), \(Y_c\), and \(Z_c\).
37
+
38
+ # Output Format
39
+
40
+ For the \(i\)th case, output `"Case #i: "` followed by a single integer, the sum of the minimum \(K_2\) so that Bob has a guaranteed winning strategy, for every \(K_1 = 1..N\).
41
+
42
+ # Sample Explanation
43
+
44
+ In the first sample case:
45
+
46
+ \( \begin{array}{c|c|c|c|c}\underline{K_1}&\underline{A[K_1]}&\underline{B[K_1]}&\underline{C[K_1]}&\underline{K_2} \\ 1&1&1&0&1 \\ 2&1&2&0&2 \\ 3&1&3&2&1 \\ 4&1&4&0&4 \end{array} \)
47
+
48
+ When \(K_1 = 1\), Bob wins when \(K_2 = 1\) because Alice takes the first card, and Bob takes the last card.
49
+
50
+ When \(K_1 = 2\), Alice will win if \(K_2 = 1\) because she can start by taking \(1\) card from the first deck. Bob then takes \(1\) card from either deck (each of which have only \(1\) card left), and Alice takes the last card. But if \(K_2 = 2\) then Bob can always win regardless of whether Alice starts by taking \(1\) card or \(2\) cards.
51
+
52
+ When \(K_1 = 3\), Bob can always win when \(K_2 = 1\). If Alice takes the single card from the second deck, Bob takes \(1\) card from the first deck and adds a new deck of size \(2\) to the table. We now have two decks of size \(2\), and it's Alice's turn. That's a losing state for Alice as we saw previously.
53
+
54
+ If Alice takes \(1\) card from the first deck and adds a new deck of size \(2\), we now have decks of size \([2, 1, 2]\). Bob will pick up the pile of size \(1\) and again we're in the same losing state for Alice. If Alice takes \(2\) cards from the first deck, we'll have decks of size \([1, 1, 2]\). Bob now takes the whole deck of size \(2\). Alice gets the next card and Bob gets the last card. Finally, if Alice takes all \(3\) cards from the first deck, we'll have decks of size \([1, 2]\). Bob can take just \(1\) card from the deck of size \(2\) to win.
55
+
56
+ In the second sample case:
57
+
58
+ \( \begin{array}{c|c|c|c|c}\underline{K_1}&\underline{A[K_1]}&\underline{B[K_1]}&\underline{C[K_1]}&\underline{K_2} \\ 1&1&1&0&1 \\ 2&1&1&0&2 \end{array} \)
59
+
60
+ In the third sample case:
61
+
62
+ \( \begin{array}{c|c|c|c|c}\underline{K_1}&\underline{A[K_1]}&\underline{B[K_1]}&\underline{C[K_1]}&\underline{K_2} \\ 1&1&1&0&1 \\ 2&1&2&0&2 \\ 3&2&3&1&2 \end{array} \)
63
+
64
+ In the fourth sample case:
65
+
66
+ \( \begin{array}{c|c|c|c|c}\underline{K_1}&\underline{A[K_1]}&\underline{B[K_1]}&\underline{C[K_1]}&\underline{K_2} \\ 1&1&1&0&1 \\ 2&1&2&0&2 \\ 3&3&3&2&3 \\ 4&1&4&0&4 \\ 5&5&5&4&3 \\ 6&1&6&0&6 \\ 7&6&7&4&3 \\ 8&1&8&0&8 \end{array} \)
2023/finals/dealing_decks.out ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 8
2
+ Case #2: 3
3
+ Case #3: 5
4
+ Case #4: 30
5
+ Case #5: 35
6
+ Case #6: 117
7
+ Case #7: 273183
8
+ Case #8: 1312463028
9
+ Case #9: 1999867993760
10
+ Case #10: 1
11
+ Case #11: 10
12
+ Case #12: 894422
13
+ Case #13: 46013012
14
+ Case #14: 27755
15
+ Case #15: 81103343152
16
+ Case #16: 7519069023
17
+ Case #17: 116625528184
18
+ Case #18: 26142781428
19
+ Case #19: 1970328389618
20
+ Case #20: 1942443692949
21
+ Case #21: 1963487342234
22
+ Case #22: 1925817311005
23
+ Case #23: 1992266026268
24
+ Case #24: 1893316038970
25
+ Case #25: 1999025192108
26
+ Case #26: 1749389735220
27
+ Case #27: 1998817856516
28
+ Case #28: 1900414850949
29
+ Case #29: 1977804916734
30
+ Case #30: 1976197732223
31
+ Case #31: 1988992390784
32
+ Case #32: 1982416741751
33
+ Case #33: 1981598424077
34
+ Case #34: 1998107636271
35
+ Case #35: 1999104419717
36
+ Case #36: 1998974708302
37
+ Case #37: 1999999333294
38
+ Case #38: 2000000999988
39
+ Case #39: 2000000999975
40
+ Case #40: 1999996333346
41
+ Case #41: 2000001000000
2023/finals/dealing_decks_sol.md ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ To start, let’s look at the Sprague-Grundy function for a deck of arbitrary size \(k\):
2
+
3
+ \[\displaystyle g(k) = \text{mex}(\{ g(k - i) \oplus g(C_k) \mid i \in [ k - B_i, k - A_i ] \}) \]
4
+
5
+ In other words, to compute the value of \(g(k)\), we can perform the following steps:
6
+
7
+ 1. Construct a set \(S\) of all values \(g(i)\), where \(i = k - B_i, ..., k - A_i\).
8
+ 2. XOR each value of \(S\) with \(C_k\).
9
+ 3. Find a mex (minimum excluded value) of \(S\) and assign it to \(g(k)\).
10
+
11
+ Since we need to compute \(g(k)\) for each \(k = 1..N\), we need a data structure that supports all the listed operations with \(\mathcal{O}(\log N)\) complexity. Such data structure exists – it’s a simple trie. Let’s represent each value of \(g(k)\) in its binary form and store binary string representations in the trie. Each node will have no more than two edges (one edge corresponds to \(0\), the other to \(1\)). For each node of the trie, let’s store the last value of \(k\) for which it has been updated.
12
+
13
+ Suppose for a certain value of \(k\) we want to find the mex of all values \(g(x)\) from \(g(l)\) to \(g(k)\). We can descend from the root of the trie to some leaf, each time going to the child which hasn’t been updated after \(l - 1\). If both child nodes satisfy this condition, we pass through \(0\)-edge. At any moment, if there is no corresponding edge, that means the node has never been updated.
14
+
15
+ Now we can modify this approach for finding the mex of all values \(g(x) \oplus y\) from \(g(l)\) to \(g(k)\) (for any value of \(y\)). To do so when both child nodes haven’t been updated after \(l - 1\) we will pass through \(0\)-edge only if the corresponding bit in \(y\) is \(0\), otherwise we will pass through \(1\)-edge.
16
+
17
+ The only modification we need now is to make this approach correct for an arbitrary right border \(r \ge l\). It can be done by simply making the trie persistent. This way we can always perform the previously explained approach on the version of the trie we had right after adding the value of \(g(r)\). The only extra price we pay is \(\log N\) times more memory usage.
18
+
19
+ Since any descent on a trie takes \(\mathcal{O}(\log N)\) steps, the overall complexity of the described approach is \(\mathcal{O}(N \log N)\).
20
+
21
+ When all values are computed, we can use them to find the value of \(K_2\) for each \(K_1\). First, \(K_2\) always exists and \(K_2 \le K_1\). If \(K_2 = K_1\), Bob can always win by mirroring Alice’s turns. Since we need Bob to win, we are interested in states where \(g(K_1) \oplus g(K_2)\) is zero and \(K_2\) is as small as possible. So all we need to do is find the minimum \(K_2\) such that \(g(K_1) = g(K_2)\). This can be done in \(\mathcal{O}(N)\) time and doesn’t affect the final \(\mathcal{O}(N \log N)\) complexity of the solution.
22
+
2023/finals/nearly_nim.cpp ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <iostream>
2
+ #include <vector>
3
+ using namespace std;
4
+
5
+ int solve() {
6
+ int N;
7
+ cin >> N;
8
+ vector<int> A(N);
9
+ for (int i = 0; i < N; i++) {
10
+ cin >> A[i];
11
+ }
12
+ int ans = 0;
13
+ vector<int> left(N + 1), right(N + 1);
14
+ for (int i = 0; i < N; i++) {
15
+ left[i + 1] = max(0, A[i] - left[i]);
16
+ }
17
+ for (int i = N - 1; i >= 0; i--) {
18
+ right[i - 1] = max(0, A[i] - right[i]);
19
+ }
20
+ for (int i = 0; i < N; i++) {
21
+ ans += max(0, A[i] - left[i] - right[i]);
22
+ }
23
+ return ans;
24
+ }
25
+
26
+ int main() {
27
+ int T;
28
+ cin >> T;
29
+ for (int t = 1; t <= T; t++) {
30
+ cout << "Case #" << t << ": " << solve() << endl;
31
+ }
32
+ return 0;
33
+ }
2023/finals/nearly_nim.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c967c209c4101f5155c3095873fdc977f4b70f7573e3d4bc68721f53cd59f3d3
3
+ size 20485727
2023/finals/nearly_nim.md ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Alice and Bob are servers at *Nim Sum Dim Sum*, a bustling dumpling restaurant. For a staff meal, the manager has generously provided \(N\) plates of dumplings in a row, numbered from \(1\) to \(N\). Initially, plate \(i\) has \(A_i\) dumplings. In classic fashion, the duo has decided to play a game.
2
+
3
+ Alice and Bob will take turns eating dumplings from the plates. On a given turn, a player must pick a plate adjacent to the last picked plate by the other player, and eat any positive number of dumplings from that plate. The first player who cannot do so on their turn loses. Alice goes first, and can choose any starting plate to eat from.
4
+
5
+ For example, suppose there are three plates holding \(4\), \(1\) and \(2\) dumplings respectively. On the first turn, Alice can eat \(3\) dumplings from the first plate. Bob must then eat the dumpling from the middle plate. Alice can respond by eating one dumpling from the third plate. Bob must then eat from plate \(2\), but since it’s empty now, he loses.
6
+
7
+ Assuming both players play optimally, how many starting moves can Alice make so that she wins? Two starting moves are considered different if Alice eats from different plates, or eats a different number of dumplings.
8
+
9
+ # Constraints
10
+
11
+ \(1 \le T \le 220\)
12
+ \(2 \le N \le 800{,}000\)
13
+ \(0 \le A_i \lt 2^{25}\)
14
+
15
+ The sum of \(N\) across all test cases is at most \(4{,}000{,}000\).
16
+
17
+ # Input Format
18
+
19
+ Input begins with an integer \(T\), the number of cases. Each case will begin with a single integer \(N\) followed by the \(N\) integers \(A_1, ..., A_N\) on the next line.
20
+
21
+ # Output Format
22
+
23
+ For the \(i\)th case, output `"Case #i: "` followed by a single integer, the number of winning starting moves Alice has.
24
+
25
+ # Sample Explanation
26
+
27
+ In the first case, Alice can start by taking any number of dumplings from either the first or third plate. Bob will then have to take the solitary dumpling on the middle plate, and Alice can win by taking all the dumplings from the plate she didn't start with. This gives Alice 6 different winning starting moves.
28
+
29
+ In the second case, Alice cannot win because she takes one dumpling, Bob takes the other, and then Alice has no move to make.
30
+
31
+ In the third case, Alice's winning moves are to take \(1\) or \(2\) dumplings from the right-hand plate.
32
+
33
+ In the fourth case, Bob can always force a win.
34
+
2023/finals/nearly_nim.out ADDED
@@ -0,0 +1,218 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: Alice
2
+ Case #2: Bob
3
+ Case #3: Alice
4
+ Case #4: Bob
5
+ Case #5: Bob
6
+ Case #6: Alice
7
+ Case #7: Bob
8
+ Case #8: Alice
9
+ Case #9: Alice
10
+ Case #10: Alice
11
+ Case #11: Alice
12
+ Case #12: Alice
13
+ Case #13: Alice
14
+ Case #14: Alice
15
+ Case #15: Bob
16
+ Case #16: Alice
17
+ Case #17: Bob
18
+ Case #18: Alice
19
+ Case #19: Alice
20
+ Case #20: Alice
21
+ Case #21: Alice
22
+ Case #22: Alice
23
+ Case #23: Alice
24
+ Case #24: Alice
25
+ Case #25: Alice
26
+ Case #26: Alice
27
+ Case #27: Alice
28
+ Case #28: Alice
29
+ Case #29: Alice
30
+ Case #30: Alice
31
+ Case #31: Alice
32
+ Case #32: Alice
33
+ Case #33: Alice
34
+ Case #34: Alice
35
+ Case #35: Alice
36
+ Case #36: Alice
37
+ Case #37: Alice
38
+ Case #38: Alice
39
+ Case #39: Alice
40
+ Case #40: Alice
41
+ Case #41: Alice
42
+ Case #42: Alice
43
+ Case #43: Alice
44
+ Case #44: Bob
45
+ Case #45: Alice
46
+ Case #46: Alice
47
+ Case #47: Alice
48
+ Case #48: Alice
49
+ Case #49: Alice
50
+ Case #50: Alice
51
+ Case #51: Alice
52
+ Case #52: Alice
53
+ Case #53: Bob
54
+ Case #54: Alice
55
+ Case #55: Alice
56
+ Case #56: Alice
57
+ Case #57: Alice
58
+ Case #58: Alice
59
+ Case #59: Alice
60
+ Case #60: Alice
61
+ Case #61: Alice
62
+ Case #62: Alice
63
+ Case #63: Alice
64
+ Case #64: Alice
65
+ Case #65: Alice
66
+ Case #66: Alice
67
+ Case #67: Alice
68
+ Case #68: Alice
69
+ Case #69: Alice
70
+ Case #70: Alice
71
+ Case #71: Alice
72
+ Case #72: Alice
73
+ Case #73: Alice
74
+ Case #74: Alice
75
+ Case #75: Alice
76
+ Case #76: Alice
77
+ Case #77: Alice
78
+ Case #78: Alice
79
+ Case #79: Bob
80
+ Case #80: Alice
81
+ Case #81: Alice
82
+ Case #82: Alice
83
+ Case #83: Alice
84
+ Case #84: Alice
85
+ Case #85: Bob
86
+ Case #86: Alice
87
+ Case #87: Alice
88
+ Case #88: Alice
89
+ Case #89: Alice
90
+ Case #90: Alice
91
+ Case #91: Alice
92
+ Case #92: Alice
93
+ Case #93: Bob
94
+ Case #94: Alice
95
+ Case #95: Alice
96
+ Case #96: Alice
97
+ Case #97: Alice
98
+ Case #98: Alice
99
+ Case #99: Alice
100
+ Case #100: Alice
101
+ Case #101: Alice
102
+ Case #102: Alice
103
+ Case #103: Bob
104
+ Case #104: Alice
105
+ Case #105: Alice
106
+ Case #106: Alice
107
+ Case #107: Alice
108
+ Case #108: Alice
109
+ Case #109: Alice
110
+ Case #110: Alice
111
+ Case #111: Alice
112
+ Case #112: Alice
113
+ Case #113: Alice
114
+ Case #114: Alice
115
+ Case #115: Alice
116
+ Case #116: Alice
117
+ Case #117: Alice
118
+ Case #118: Bob
119
+ Case #119: Alice
120
+ Case #120: Alice
121
+ Case #121: Alice
122
+ Case #122: Alice
123
+ Case #123: Alice
124
+ Case #124: Alice
125
+ Case #125: Alice
126
+ Case #126: Alice
127
+ Case #127: Alice
128
+ Case #128: Alice
129
+ Case #129: Alice
130
+ Case #130: Alice
131
+ Case #131: Alice
132
+ Case #132: Alice
133
+ Case #133: Alice
134
+ Case #134: Alice
135
+ Case #135: Alice
136
+ Case #136: Alice
137
+ Case #137: Alice
138
+ Case #138: Alice
139
+ Case #139: Alice
140
+ Case #140: Alice
141
+ Case #141: Alice
142
+ Case #142: Alice
143
+ Case #143: Alice
144
+ Case #144: Alice
145
+ Case #145: Alice
146
+ Case #146: Alice
147
+ Case #147: Alice
148
+ Case #148: Alice
149
+ Case #149: Alice
150
+ Case #150: Alice
151
+ Case #151: Alice
152
+ Case #152: Alice
153
+ Case #153: Alice
154
+ Case #154: Bob
155
+ Case #155: Alice
156
+ Case #156: Alice
157
+ Case #157: Alice
158
+ Case #158: Alice
159
+ Case #159: Alice
160
+ Case #160: Bob
161
+ Case #161: Alice
162
+ Case #162: Alice
163
+ Case #163: Alice
164
+ Case #164: Alice
165
+ Case #165: Alice
166
+ Case #166: Alice
167
+ Case #167: Bob
168
+ Case #168: Alice
169
+ Case #169: Alice
170
+ Case #170: Alice
171
+ Case #171: Alice
172
+ Case #172: Alice
173
+ Case #173: Alice
174
+ Case #174: Alice
175
+ Case #175: Alice
176
+ Case #176: Alice
177
+ Case #177: Alice
178
+ Case #178: Alice
179
+ Case #179: Alice
180
+ Case #180: Alice
181
+ Case #181: Alice
182
+ Case #182: Alice
183
+ Case #183: Alice
184
+ Case #184: Alice
185
+ Case #185: Alice
186
+ Case #186: Alice
187
+ Case #187: Alice
188
+ Case #188: Alice
189
+ Case #189: Alice
190
+ Case #190: Alice
191
+ Case #191: Alice
192
+ Case #192: Alice
193
+ Case #193: Bob
194
+ Case #194: Alice
195
+ Case #195: Alice
196
+ Case #196: Alice
197
+ Case #197: Alice
198
+ Case #198: Alice
199
+ Case #199: Alice
200
+ Case #200: Bob
201
+ Case #201: Alice
202
+ Case #202: Alice
203
+ Case #203: Alice
204
+ Case #204: Alice
205
+ Case #205: Alice
206
+ Case #206: Alice
207
+ Case #207: Alice
208
+ Case #208: Alice
209
+ Case #209: Alice
210
+ Case #210: Alice
211
+ Case #211: Alice
212
+ Case #212: Alice
213
+ Case #213: Alice
214
+ Case #214: Alice
215
+ Case #215: Alice
216
+ Case #216: Alice
217
+ Case #217: Alice
218
+ Case #218: Alice
2023/finals/nearly_nim_sol.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Since you must eat dumplings on a plate adjacent to your opponent, after the first move, it's uniquely determined who will eat from even plates and who will eat from odd plates. Therefore, other than Alice's first move, neither player will ever eat more than one dumpling on a turn.
2
+
3
+ First, let's determine whether some board state is winning or losing for the current player. Suppose \(A[0] > A[1]\). In this case, Alice can win by eating from \(A[0]\), and will lose if she eats from \(A[1]\). Importantly, notice that if Alice eats from \(A[2...n]\), neither player will ever eat from \(A[1]\) as it will cause them to lose—their opponent can keep eating \(A[0]\), and \(A[1]\) will run out first.
4
+
5
+ Therefore (if \(A[0] > A[1]\) and the first move doesn't involve \(A[0]\)), we can replace \(A[0]\) and \(A[1]\) with \(0\)'s and it will not change the result of the game.
6
+
7
+ On the other hand if \(A[0] \leq A[1]\), then if our opponent ever eats from \(A[1]\), we should keep eating from \(A[0]\) as many times as possible to decrease \(A[1]\). We can prove this is optimal with a greedy principle: dumplings at position \(0\) can at best cause your opponent to have to eat one more dumpling from position \(1\), and at worst will never be eaten because your opponent won't give you the chance. Either way, we'll have to continue playing on pile \(2\), and it's better for us if the opponent has fewer dumplings left on pile \(1\).
8
+
9
+ Therefore (if \(A[0] \leq A[1]\) and the first move doesn't involve \(A[0]\)), then we can replace \(A[0]\) with \(0\), and \(A[1]\) with \(A[1]-A[0]\), and it will not change the result of our game.
10
+
11
+ Of course, these observations are symmetric, so they apply to \(A[N]\) and \(A[N-1]\) in the same way as \(A[0]\) and \(A[1]\).
12
+
13
+ If the first move was made at position \(A[7]\) for example, then in linear time we can repeatedly simplify each end of the array until the only elements that are left are \(A[6], A[7],\) and \(A[8]\). We either delete the first/last two elements, or delete the first/last element, and decrease the second/second last. When we're done, this leaves us with an array of size \(3\), and all that matters is the total number of dumplings in the middle vs. on the sides. If after she takes dumplings from \(A[7]\), Alice will win if \(A[7] \geq A[6]+A[8]\). This leaves us with \(\max(0, A[7]-A[6]-A[8])\) ways of winning that start with position \(7\).
14
+
15
+ This gives us an \(\mathcal{O}(N^2)\) solution since we are brute forcing the first move. But it turns out that each side is independent, so we can do a DP on each prefix and suffix to count what each prefix and suffix leaves you with, and this gives us an \(\mathcal{O}(N)\) solution.
16
+
2023/finals/programming_paths_part_1.cpp ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <iostream>
3
+ #include <vector>
4
+ using namespace std;
5
+
6
+ const int N = 13;
7
+
8
+ vector<string> G;
9
+ vector<int> b;
10
+ vector<vector<int>> len;
11
+ vector<vector<pair<int, int>>> cells;
12
+
13
+ inline bool check(int r, int c) {
14
+ return r >= 0 && c >= 0 && r < N && c < N;
15
+ }
16
+
17
+ void dfs(int r, int c, int l) {
18
+ len[r][c] = l;
19
+ if (static_cast<int>(cells.size()) <= l) {
20
+ cells.resize(l + 1);
21
+ }
22
+ cells[l].emplace_back(r, c);
23
+ for (auto [r2, c2] : {pair{r - 1, c}, {r + 1, c}, {r, c - 1}, {r, c + 1}}) {
24
+ if (!check(r2, c2) || G[r2][c2] == '#' || len[r2][c2] != -1) {
25
+ continue;
26
+ }
27
+ dfs(r2, c2, l + 1);
28
+ }
29
+ }
30
+
31
+ int count_adj(int r, int c) {
32
+ int res = 0;
33
+ for (auto [r2, c2] : {pair{r - 1, c}, {r + 1, c}, {r, c - 1}, {r, c + 1}}) {
34
+ if (!check(r2, c2)) {
35
+ continue;
36
+ }
37
+ res += G[r2][c2] == '#';
38
+ }
39
+ return res;
40
+ }
41
+
42
+ void run(int r, int c, int l) {
43
+ len[r][c] = l;
44
+ if (l & 1) {
45
+ for (auto [r2, c2] : {pair{r - 1, c}, {r + 1, c}, {r, c - 1}, {r, c + 1}}) {
46
+ if (!check(r2, c2) || G[r2][c2] != '#') {
47
+ continue;
48
+ }
49
+ if (count_adj(r2, c2) == 3) {
50
+ G[r2][c2] = '.';
51
+ break;
52
+ }
53
+ }
54
+ }
55
+ for (auto [r2, c2] : {pair{r - 1, c}, {r + 1, c}, {r, c - 1}, {r, c + 1}}) {
56
+ if (!check(r2, c2) || G[r2][c2] == '#' || len[r2][c2] != -1) {
57
+ continue;
58
+ }
59
+ run(r2, c2, l + 1);
60
+ }
61
+ }
62
+
63
+ void solve() {
64
+ int K;
65
+ cin >> K;
66
+ b.clear();
67
+ for (int x = K; x; x >>= 1) {
68
+ b.push_back(x & 1);
69
+ }
70
+ reverse(b.begin(), b.end());
71
+ G.assign(N, string(N, '.'));
72
+ G[0][0] = '@';
73
+ for (int j = 1, par = 0; j < N; j += 3, par ^= 1) {
74
+ int st = 0, fn = N;
75
+ if (par) {
76
+ st += 1;
77
+ } else {
78
+ fn -= 1;
79
+ }
80
+ for (int i = st; i < fn; i++) {
81
+ G[i][j] = '#';
82
+ G[i][j + 1] = '#';
83
+ }
84
+ }
85
+ len.assign(N, vector<int>(N, -1));
86
+ run(0, 0, 0);
87
+ len.assign(N, vector<int>(N, -1));
88
+ cells.clear();
89
+ dfs(0, 0, 0);
90
+ vector<int> d0;
91
+ for (int i = 2; i < (int)cells.size(); i += 2) {
92
+ if (d0.size() & 1) {
93
+ d0.push_back(i);
94
+ continue;
95
+ }
96
+ if (cells[i].size() > 1) {
97
+ d0.push_back(i);
98
+ }
99
+ }
100
+ for (int i = 0, ind = 0; i < (int)b.size(); i++, ind += 2) {
101
+ if (b[i]) {
102
+ int d = d0[ind];
103
+ for (int j = 0; j <= 1; j++) {
104
+ auto [r, c] = cells[d][j];
105
+ G[r][c] = '*';
106
+ }
107
+ }
108
+ for (int j = 0; j <= 1; j++) {
109
+ int d = d0[ind + 1] + j;
110
+ auto [r, c] = cells[d][0];
111
+ G[r][c] = '*';
112
+ }
113
+ }
114
+ cout << N << " " << N << endl;
115
+ for (int i = 0; i < N; i++) {
116
+ cout << G[i] << endl;
117
+ }
118
+ }
119
+
120
+ int main() {
121
+ int T;
122
+ cin >> T;
123
+ for (int t = 1; t <= T; t++) {
124
+ cout << "Case #" << t << ": ";
125
+ solve();
126
+ }
127
+ return 0;
128
+ }
2023/finals/programming_paths_part_1.in ADDED
@@ -0,0 +1,2001 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2000
2
+ 0
3
+ 1
4
+ 10
5
+ 10000
6
+ 11
7
+ 12
8
+ 1212
9
+ 1237
10
+ 13
11
+ 1337
12
+ 14
13
+ 1473
14
+ 15
15
+ 1523
16
+ 16
17
+ 17
18
+ 18
19
+ 1833
20
+ 1855
21
+ 19
22
+ 2
23
+ 20
24
+ 210
25
+ 2295
26
+ 2494
27
+ 2576
28
+ 2666
29
+ 2827
30
+ 296
31
+ 3
32
+ 3026
33
+ 3162
34
+ 3229
35
+ 4
36
+ 4136
37
+ 4178
38
+ 4330
39
+ 4437
40
+ 466
41
+ 4748
42
+ 4889
43
+ 4923
44
+ 5
45
+ 5072
46
+ 5105
47
+ 512
48
+ 513
49
+ 518
50
+ 5180
51
+ 5383
52
+ 5424
53
+ 5522
54
+ 5660
55
+ 5747
56
+ 5840
57
+ 5944
58
+ 6
59
+ 6144
60
+ 6187
61
+ 621
62
+ 63
63
+ 6318
64
+ 6413
65
+ 6758
66
+ 7
67
+ 7097
68
+ 7175
69
+ 7308
70
+ 7495
71
+ 7496
72
+ 7560
73
+ 7577
74
+ 7696
75
+ 8
76
+ 8078
77
+ 8079
78
+ 8080
79
+ 8081
80
+ 8082
81
+ 8083
82
+ 8084
83
+ 8085
84
+ 8086
85
+ 8087
86
+ 8088
87
+ 8089
88
+ 8090
89
+ 8091
90
+ 8092
91
+ 8093
92
+ 8094
93
+ 8095
94
+ 8096
95
+ 8097
96
+ 8098
97
+ 8099
98
+ 8100
99
+ 8101
100
+ 8102
101
+ 8103
102
+ 8104
103
+ 8105
104
+ 8106
105
+ 8107
106
+ 8108
107
+ 8109
108
+ 8110
109
+ 8111
110
+ 8112
111
+ 8113
112
+ 8114
113
+ 8115
114
+ 8116
115
+ 8117
116
+ 8118
117
+ 8119
118
+ 8120
119
+ 8121
120
+ 8122
121
+ 8123
122
+ 8124
123
+ 8125
124
+ 8126
125
+ 8127
126
+ 8128
127
+ 8129
128
+ 8130
129
+ 8131
130
+ 8132
131
+ 8133
132
+ 8134
133
+ 8135
134
+ 8136
135
+ 8137
136
+ 8138
137
+ 8139
138
+ 8140
139
+ 8141
140
+ 8142
141
+ 8143
142
+ 8144
143
+ 8145
144
+ 8146
145
+ 8147
146
+ 8148
147
+ 8149
148
+ 8150
149
+ 8151
150
+ 8152
151
+ 8153
152
+ 8154
153
+ 8155
154
+ 8156
155
+ 8157
156
+ 8158
157
+ 8159
158
+ 8160
159
+ 8161
160
+ 8162
161
+ 8163
162
+ 8164
163
+ 8165
164
+ 8166
165
+ 8167
166
+ 8168
167
+ 8169
168
+ 8170
169
+ 8170
170
+ 8171
171
+ 8172
172
+ 8173
173
+ 8174
174
+ 8175
175
+ 8176
176
+ 8177
177
+ 8178
178
+ 8179
179
+ 8180
180
+ 8181
181
+ 8182
182
+ 8183
183
+ 8184
184
+ 8185
185
+ 8186
186
+ 8187
187
+ 8188
188
+ 8189
189
+ 8190
190
+ 8191
191
+ 8192
192
+ 8193
193
+ 8194
194
+ 8195
195
+ 8196
196
+ 8197
197
+ 8198
198
+ 8199
199
+ 8200
200
+ 8201
201
+ 8202
202
+ 8203
203
+ 8204
204
+ 8205
205
+ 8206
206
+ 8207
207
+ 8208
208
+ 8209
209
+ 8210
210
+ 8211
211
+ 8212
212
+ 8213
213
+ 8214
214
+ 8215
215
+ 8216
216
+ 8217
217
+ 8218
218
+ 8219
219
+ 8220
220
+ 8221
221
+ 8222
222
+ 8223
223
+ 8224
224
+ 8225
225
+ 8226
226
+ 8227
227
+ 8228
228
+ 8229
229
+ 8230
230
+ 8231
231
+ 8232
232
+ 8233
233
+ 8234
234
+ 8235
235
+ 8236
236
+ 8237
237
+ 8238
238
+ 8239
239
+ 8240
240
+ 8241
241
+ 8242
242
+ 8243
243
+ 8244
244
+ 8245
245
+ 8246
246
+ 8247
247
+ 8248
248
+ 8249
249
+ 8250
250
+ 8251
251
+ 8252
252
+ 8253
253
+ 8254
254
+ 8255
255
+ 8256
256
+ 8257
257
+ 8258
258
+ 8259
259
+ 8260
260
+ 8261
261
+ 8262
262
+ 8263
263
+ 8264
264
+ 8265
265
+ 8266
266
+ 8267
267
+ 8268
268
+ 8269
269
+ 8270
270
+ 8271
271
+ 8272
272
+ 8273
273
+ 8274
274
+ 8275
275
+ 8276
276
+ 8277
277
+ 8278
278
+ 8279
279
+ 8280
280
+ 8281
281
+ 8282
282
+ 8283
283
+ 8284
284
+ 8285
285
+ 8286
286
+ 8287
287
+ 8288
288
+ 8289
289
+ 8290
290
+ 8291
291
+ 8292
292
+ 8293
293
+ 8294
294
+ 8295
295
+ 8296
296
+ 8297
297
+ 8298
298
+ 8299
299
+ 8300
300
+ 8301
301
+ 8302
302
+ 8303
303
+ 8304
304
+ 8305
305
+ 8306
306
+ 8307
307
+ 8308
308
+ 8309
309
+ 8310
310
+ 8311
311
+ 8312
312
+ 8313
313
+ 8314
314
+ 8315
315
+ 8316
316
+ 8317
317
+ 8318
318
+ 8319
319
+ 8320
320
+ 8321
321
+ 8322
322
+ 8323
323
+ 8324
324
+ 8325
325
+ 8326
326
+ 8327
327
+ 8328
328
+ 8329
329
+ 8330
330
+ 8331
331
+ 8332
332
+ 8333
333
+ 8334
334
+ 8335
335
+ 8336
336
+ 8337
337
+ 8338
338
+ 8339
339
+ 8340
340
+ 8341
341
+ 8342
342
+ 8343
343
+ 8344
344
+ 8345
345
+ 8346
346
+ 8347
347
+ 8348
348
+ 8349
349
+ 8350
350
+ 8351
351
+ 8352
352
+ 8353
353
+ 8354
354
+ 8355
355
+ 8356
356
+ 8357
357
+ 8358
358
+ 8359
359
+ 8360
360
+ 8361
361
+ 8362
362
+ 8363
363
+ 8364
364
+ 8365
365
+ 8366
366
+ 8367
367
+ 8368
368
+ 8369
369
+ 8370
370
+ 8371
371
+ 8372
372
+ 8373
373
+ 8374
374
+ 8375
375
+ 8376
376
+ 8377
377
+ 8378
378
+ 8379
379
+ 8380
380
+ 8381
381
+ 8382
382
+ 8383
383
+ 8384
384
+ 8385
385
+ 8386
386
+ 8387
387
+ 8388
388
+ 8389
389
+ 8390
390
+ 8391
391
+ 8392
392
+ 8393
393
+ 8394
394
+ 8395
395
+ 8396
396
+ 8397
397
+ 8398
398
+ 8399
399
+ 8400
400
+ 8401
401
+ 8402
402
+ 8403
403
+ 8404
404
+ 8405
405
+ 8406
406
+ 8407
407
+ 8408
408
+ 8409
409
+ 8410
410
+ 8411
411
+ 8412
412
+ 8413
413
+ 8414
414
+ 8415
415
+ 8416
416
+ 8417
417
+ 8418
418
+ 8419
419
+ 8420
420
+ 8421
421
+ 8422
422
+ 8423
423
+ 8424
424
+ 8425
425
+ 8426
426
+ 8427
427
+ 8428
428
+ 8429
429
+ 8430
430
+ 8431
431
+ 8432
432
+ 8433
433
+ 8434
434
+ 8435
435
+ 8436
436
+ 8437
437
+ 8438
438
+ 8439
439
+ 8440
440
+ 8441
441
+ 8442
442
+ 8443
443
+ 8444
444
+ 8445
445
+ 8446
446
+ 8447
447
+ 8448
448
+ 8449
449
+ 8450
450
+ 8451
451
+ 8452
452
+ 8453
453
+ 8454
454
+ 8455
455
+ 8456
456
+ 8457
457
+ 8458
458
+ 8459
459
+ 8460
460
+ 8461
461
+ 8462
462
+ 8463
463
+ 8464
464
+ 8465
465
+ 8466
466
+ 8467
467
+ 8468
468
+ 8469
469
+ 8470
470
+ 8471
471
+ 8472
472
+ 8473
473
+ 8474
474
+ 8475
475
+ 8476
476
+ 8477
477
+ 8478
478
+ 8479
479
+ 8480
480
+ 8481
481
+ 8482
482
+ 8483
483
+ 8484
484
+ 8485
485
+ 8486
486
+ 8487
487
+ 8488
488
+ 8489
489
+ 8490
490
+ 8491
491
+ 8492
492
+ 8493
493
+ 8494
494
+ 8495
495
+ 8496
496
+ 8497
497
+ 8498
498
+ 8499
499
+ 8500
500
+ 8501
501
+ 8502
502
+ 8503
503
+ 8504
504
+ 8505
505
+ 8506
506
+ 8507
507
+ 8508
508
+ 8509
509
+ 8510
510
+ 8511
511
+ 8512
512
+ 8513
513
+ 8514
514
+ 8515
515
+ 8516
516
+ 8517
517
+ 8518
518
+ 8519
519
+ 8520
520
+ 8521
521
+ 8522
522
+ 8523
523
+ 8524
524
+ 8525
525
+ 8526
526
+ 8527
527
+ 8528
528
+ 8529
529
+ 8530
530
+ 8531
531
+ 8532
532
+ 8533
533
+ 8534
534
+ 8535
535
+ 8536
536
+ 8537
537
+ 8538
538
+ 8539
539
+ 8540
540
+ 8541
541
+ 8542
542
+ 8543
543
+ 8544
544
+ 8545
545
+ 8546
546
+ 8547
547
+ 8548
548
+ 8549
549
+ 8550
550
+ 8551
551
+ 8552
552
+ 8553
553
+ 8554
554
+ 8555
555
+ 8556
556
+ 8557
557
+ 8558
558
+ 8559
559
+ 8560
560
+ 8561
561
+ 8562
562
+ 8563
563
+ 8564
564
+ 8565
565
+ 8566
566
+ 8567
567
+ 8568
568
+ 8569
569
+ 8570
570
+ 8571
571
+ 8572
572
+ 8573
573
+ 8574
574
+ 8575
575
+ 8576
576
+ 8577
577
+ 8578
578
+ 8579
579
+ 8580
580
+ 8581
581
+ 8582
582
+ 8583
583
+ 8584
584
+ 8585
585
+ 8586
586
+ 8587
587
+ 8588
588
+ 8589
589
+ 8590
590
+ 8591
591
+ 8592
592
+ 8593
593
+ 8594
594
+ 8595
595
+ 8596
596
+ 8597
597
+ 8598
598
+ 8599
599
+ 8600
600
+ 8601
601
+ 8602
602
+ 8603
603
+ 8604
604
+ 8605
605
+ 8606
606
+ 8607
607
+ 8608
608
+ 8609
609
+ 8610
610
+ 8611
611
+ 8612
612
+ 8613
613
+ 8614
614
+ 8615
615
+ 8616
616
+ 8617
617
+ 8618
618
+ 8619
619
+ 8620
620
+ 8621
621
+ 8622
622
+ 8623
623
+ 8624
624
+ 8625
625
+ 8626
626
+ 8627
627
+ 8628
628
+ 8629
629
+ 8630
630
+ 8631
631
+ 8632
632
+ 8633
633
+ 8634
634
+ 8635
635
+ 8636
636
+ 8637
637
+ 8638
638
+ 8639
639
+ 8640
640
+ 8641
641
+ 8642
642
+ 8643
643
+ 8644
644
+ 8645
645
+ 8646
646
+ 8647
647
+ 8648
648
+ 8649
649
+ 8650
650
+ 8651
651
+ 8652
652
+ 8653
653
+ 8654
654
+ 8655
655
+ 8656
656
+ 8657
657
+ 8658
658
+ 8659
659
+ 8660
660
+ 8661
661
+ 8662
662
+ 8663
663
+ 8664
664
+ 8665
665
+ 8666
666
+ 8667
667
+ 8668
668
+ 8669
669
+ 8670
670
+ 8671
671
+ 8672
672
+ 8673
673
+ 8674
674
+ 8675
675
+ 8676
676
+ 8677
677
+ 8678
678
+ 8679
679
+ 8680
680
+ 8681
681
+ 8682
682
+ 8683
683
+ 8684
684
+ 8685
685
+ 8686
686
+ 8687
687
+ 8688
688
+ 8689
689
+ 8690
690
+ 8691
691
+ 8692
692
+ 8693
693
+ 8694
694
+ 8695
695
+ 8696
696
+ 8697
697
+ 8698
698
+ 8699
699
+ 8700
700
+ 8701
701
+ 8702
702
+ 8703
703
+ 8704
704
+ 8705
705
+ 8706
706
+ 8707
707
+ 8708
708
+ 8709
709
+ 8710
710
+ 8711
711
+ 8712
712
+ 8713
713
+ 8714
714
+ 8715
715
+ 8716
716
+ 8717
717
+ 8718
718
+ 8719
719
+ 8720
720
+ 8721
721
+ 8722
722
+ 8723
723
+ 8724
724
+ 8725
725
+ 8726
726
+ 8727
727
+ 8728
728
+ 8729
729
+ 8730
730
+ 8731
731
+ 8732
732
+ 8733
733
+ 8734
734
+ 8735
735
+ 8736
736
+ 8737
737
+ 8738
738
+ 8739
739
+ 8740
740
+ 8741
741
+ 8742
742
+ 8743
743
+ 8744
744
+ 8745
745
+ 8746
746
+ 8747
747
+ 8748
748
+ 8749
749
+ 8750
750
+ 8751
751
+ 8752
752
+ 8753
753
+ 8754
754
+ 8755
755
+ 8756
756
+ 8757
757
+ 8758
758
+ 8759
759
+ 8760
760
+ 8761
761
+ 8762
762
+ 8763
763
+ 8764
764
+ 8765
765
+ 8766
766
+ 8767
767
+ 8768
768
+ 8769
769
+ 8770
770
+ 8771
771
+ 8772
772
+ 8773
773
+ 8774
774
+ 8775
775
+ 8776
776
+ 8777
777
+ 8778
778
+ 8779
779
+ 8780
780
+ 8781
781
+ 8782
782
+ 8783
783
+ 8784
784
+ 8785
785
+ 8786
786
+ 8787
787
+ 8788
788
+ 8789
789
+ 8790
790
+ 8791
791
+ 8792
792
+ 8793
793
+ 8794
794
+ 8795
795
+ 8796
796
+ 8797
797
+ 8798
798
+ 8799
799
+ 8800
800
+ 8801
801
+ 8802
802
+ 8803
803
+ 8804
804
+ 8805
805
+ 8806
806
+ 8807
807
+ 8808
808
+ 8809
809
+ 8810
810
+ 8811
811
+ 8812
812
+ 8813
813
+ 8814
814
+ 8815
815
+ 8816
816
+ 8817
817
+ 8818
818
+ 8819
819
+ 8820
820
+ 8821
821
+ 8822
822
+ 8823
823
+ 8824
824
+ 8825
825
+ 8826
826
+ 8827
827
+ 8828
828
+ 8829
829
+ 8830
830
+ 8831
831
+ 8832
832
+ 8833
833
+ 8834
834
+ 8835
835
+ 8836
836
+ 8837
837
+ 8838
838
+ 8839
839
+ 8840
840
+ 8841
841
+ 8842
842
+ 8843
843
+ 8844
844
+ 8845
845
+ 8846
846
+ 8847
847
+ 8848
848
+ 8849
849
+ 8850
850
+ 8851
851
+ 8852
852
+ 8853
853
+ 8854
854
+ 8855
855
+ 8856
856
+ 8857
857
+ 8858
858
+ 8859
859
+ 8860
860
+ 8861
861
+ 8862
862
+ 8863
863
+ 8864
864
+ 8865
865
+ 8866
866
+ 8867
867
+ 8868
868
+ 8869
869
+ 8870
870
+ 8871
871
+ 8872
872
+ 8873
873
+ 8874
874
+ 8875
875
+ 8876
876
+ 8877
877
+ 8878
878
+ 8879
879
+ 8880
880
+ 8881
881
+ 8882
882
+ 8883
883
+ 8884
884
+ 8885
885
+ 8886
886
+ 8887
887
+ 8888
888
+ 8889
889
+ 8890
890
+ 8891
891
+ 8892
892
+ 8893
893
+ 8894
894
+ 8895
895
+ 8896
896
+ 8897
897
+ 8898
898
+ 8899
899
+ 890
900
+ 8900
901
+ 8901
902
+ 8902
903
+ 8903
904
+ 8904
905
+ 8905
906
+ 8906
907
+ 8907
908
+ 8908
909
+ 8909
910
+ 8910
911
+ 8911
912
+ 8912
913
+ 8913
914
+ 8914
915
+ 8915
916
+ 8916
917
+ 8917
918
+ 8918
919
+ 8919
920
+ 8920
921
+ 8921
922
+ 8922
923
+ 8923
924
+ 8924
925
+ 8925
926
+ 8926
927
+ 8927
928
+ 8928
929
+ 8929
930
+ 8930
931
+ 8931
932
+ 8932
933
+ 8933
934
+ 8934
935
+ 8935
936
+ 8936
937
+ 8937
938
+ 8938
939
+ 8939
940
+ 8940
941
+ 8941
942
+ 8942
943
+ 8943
944
+ 8944
945
+ 8945
946
+ 8946
947
+ 8947
948
+ 8948
949
+ 8949
950
+ 8950
951
+ 8951
952
+ 8952
953
+ 8953
954
+ 8954
955
+ 8955
956
+ 8956
957
+ 8957
958
+ 8958
959
+ 8959
960
+ 8960
961
+ 8961
962
+ 8962
963
+ 8963
964
+ 8964
965
+ 8965
966
+ 8966
967
+ 8967
968
+ 8968
969
+ 8969
970
+ 8970
971
+ 8971
972
+ 8972
973
+ 8973
974
+ 8974
975
+ 8975
976
+ 8976
977
+ 8977
978
+ 8978
979
+ 8979
980
+ 8980
981
+ 8981
982
+ 8982
983
+ 8983
984
+ 8984
985
+ 8985
986
+ 8986
987
+ 8987
988
+ 8988
989
+ 8989
990
+ 8990
991
+ 8991
992
+ 8992
993
+ 8993
994
+ 8994
995
+ 8995
996
+ 8996
997
+ 8997
998
+ 8998
999
+ 8999
1000
+ 9
1001
+ 9000
1002
+ 9001
1003
+ 9002
1004
+ 9003
1005
+ 9004
1006
+ 9005
1007
+ 9006
1008
+ 9007
1009
+ 9008
1010
+ 9009
1011
+ 9010
1012
+ 9011
1013
+ 9012
1014
+ 9013
1015
+ 9014
1016
+ 9015
1017
+ 9016
1018
+ 9017
1019
+ 9018
1020
+ 9019
1021
+ 9020
1022
+ 9021
1023
+ 9022
1024
+ 9023
1025
+ 9024
1026
+ 9025
1027
+ 9026
1028
+ 9027
1029
+ 9028
1030
+ 9029
1031
+ 9030
1032
+ 9031
1033
+ 9032
1034
+ 9033
1035
+ 9034
1036
+ 9035
1037
+ 9036
1038
+ 9037
1039
+ 9038
1040
+ 9039
1041
+ 9040
1042
+ 9041
1043
+ 9042
1044
+ 9043
1045
+ 9044
1046
+ 9045
1047
+ 9046
1048
+ 9047
1049
+ 9048
1050
+ 9049
1051
+ 9050
1052
+ 9051
1053
+ 9052
1054
+ 9053
1055
+ 9054
1056
+ 9055
1057
+ 9056
1058
+ 9057
1059
+ 9058
1060
+ 9059
1061
+ 9060
1062
+ 9061
1063
+ 9062
1064
+ 9063
1065
+ 9064
1066
+ 9065
1067
+ 9066
1068
+ 9067
1069
+ 9068
1070
+ 9069
1071
+ 9070
1072
+ 9071
1073
+ 9072
1074
+ 9073
1075
+ 9074
1076
+ 9075
1077
+ 9076
1078
+ 9077
1079
+ 9078
1080
+ 9079
1081
+ 9080
1082
+ 9081
1083
+ 9082
1084
+ 9083
1085
+ 9084
1086
+ 9085
1087
+ 9086
1088
+ 9087
1089
+ 9088
1090
+ 9089
1091
+ 9090
1092
+ 9091
1093
+ 9092
1094
+ 9093
1095
+ 9094
1096
+ 9095
1097
+ 9096
1098
+ 9097
1099
+ 9098
1100
+ 9099
1101
+ 9100
1102
+ 9101
1103
+ 9102
1104
+ 9103
1105
+ 9104
1106
+ 9105
1107
+ 9106
1108
+ 9107
1109
+ 9108
1110
+ 9109
1111
+ 9110
1112
+ 9111
1113
+ 9112
1114
+ 9113
1115
+ 9114
1116
+ 9115
1117
+ 9116
1118
+ 9117
1119
+ 9118
1120
+ 9119
1121
+ 9120
1122
+ 9121
1123
+ 9122
1124
+ 9123
1125
+ 9124
1126
+ 9125
1127
+ 9126
1128
+ 9127
1129
+ 9128
1130
+ 9129
1131
+ 9130
1132
+ 9131
1133
+ 9132
1134
+ 9133
1135
+ 9134
1136
+ 9135
1137
+ 9136
1138
+ 9137
1139
+ 9138
1140
+ 9139
1141
+ 9140
1142
+ 9141
1143
+ 9142
1144
+ 9143
1145
+ 9144
1146
+ 9145
1147
+ 9146
1148
+ 9147
1149
+ 9148
1150
+ 9149
1151
+ 9150
1152
+ 9151
1153
+ 9152
1154
+ 9153
1155
+ 9154
1156
+ 9155
1157
+ 9156
1158
+ 9157
1159
+ 9158
1160
+ 9159
1161
+ 9160
1162
+ 9161
1163
+ 9162
1164
+ 9163
1165
+ 9164
1166
+ 9165
1167
+ 9166
1168
+ 9167
1169
+ 9168
1170
+ 9169
1171
+ 9170
1172
+ 9171
1173
+ 9172
1174
+ 9173
1175
+ 9174
1176
+ 9175
1177
+ 9176
1178
+ 9177
1179
+ 9178
1180
+ 9179
1181
+ 9180
1182
+ 9181
1183
+ 9182
1184
+ 9183
1185
+ 9184
1186
+ 9185
1187
+ 9186
1188
+ 9187
1189
+ 9188
1190
+ 9189
1191
+ 919
1192
+ 9190
1193
+ 9191
1194
+ 9192
1195
+ 9193
1196
+ 9194
1197
+ 9195
1198
+ 9196
1199
+ 9197
1200
+ 9198
1201
+ 9199
1202
+ 9200
1203
+ 9201
1204
+ 9202
1205
+ 9203
1206
+ 9204
1207
+ 9205
1208
+ 9206
1209
+ 9207
1210
+ 9208
1211
+ 9209
1212
+ 9210
1213
+ 9211
1214
+ 9212
1215
+ 9213
1216
+ 9214
1217
+ 9215
1218
+ 9216
1219
+ 9217
1220
+ 9218
1221
+ 9219
1222
+ 9220
1223
+ 9221
1224
+ 9222
1225
+ 9223
1226
+ 9224
1227
+ 9225
1228
+ 9226
1229
+ 9227
1230
+ 9228
1231
+ 9229
1232
+ 9230
1233
+ 9231
1234
+ 9232
1235
+ 9233
1236
+ 9234
1237
+ 9235
1238
+ 9236
1239
+ 9237
1240
+ 9238
1241
+ 9239
1242
+ 9240
1243
+ 9241
1244
+ 9242
1245
+ 9243
1246
+ 9244
1247
+ 9245
1248
+ 9246
1249
+ 9247
1250
+ 9248
1251
+ 9249
1252
+ 9250
1253
+ 9251
1254
+ 9252
1255
+ 9253
1256
+ 9254
1257
+ 9255
1258
+ 9256
1259
+ 9257
1260
+ 9258
1261
+ 9259
1262
+ 9260
1263
+ 9261
1264
+ 9262
1265
+ 9263
1266
+ 9264
1267
+ 9265
1268
+ 9266
1269
+ 9267
1270
+ 9268
1271
+ 9269
1272
+ 9270
1273
+ 9271
1274
+ 9272
1275
+ 9273
1276
+ 9274
1277
+ 9275
1278
+ 9276
1279
+ 9277
1280
+ 9278
1281
+ 9279
1282
+ 9280
1283
+ 9281
1284
+ 9282
1285
+ 9283
1286
+ 9284
1287
+ 9285
1288
+ 9286
1289
+ 9287
1290
+ 9288
1291
+ 9289
1292
+ 9290
1293
+ 9291
1294
+ 9292
1295
+ 9293
1296
+ 9294
1297
+ 9295
1298
+ 9296
1299
+ 9297
1300
+ 9298
1301
+ 9299
1302
+ 9300
1303
+ 9301
1304
+ 9302
1305
+ 9303
1306
+ 9304
1307
+ 9305
1308
+ 9306
1309
+ 9307
1310
+ 9308
1311
+ 9309
1312
+ 9310
1313
+ 9311
1314
+ 9312
1315
+ 9313
1316
+ 9314
1317
+ 9315
1318
+ 9316
1319
+ 9317
1320
+ 9318
1321
+ 9319
1322
+ 9320
1323
+ 9321
1324
+ 9322
1325
+ 9323
1326
+ 9324
1327
+ 9325
1328
+ 9326
1329
+ 9327
1330
+ 9328
1331
+ 9329
1332
+ 9330
1333
+ 9331
1334
+ 9332
1335
+ 9333
1336
+ 9334
1337
+ 9335
1338
+ 9336
1339
+ 9337
1340
+ 9338
1341
+ 9339
1342
+ 9340
1343
+ 9341
1344
+ 9342
1345
+ 9343
1346
+ 9344
1347
+ 9345
1348
+ 9346
1349
+ 9347
1350
+ 9348
1351
+ 9349
1352
+ 9350
1353
+ 9351
1354
+ 9352
1355
+ 9353
1356
+ 9354
1357
+ 9355
1358
+ 9356
1359
+ 9357
1360
+ 9358
1361
+ 9359
1362
+ 9360
1363
+ 9361
1364
+ 9362
1365
+ 9363
1366
+ 9364
1367
+ 9365
1368
+ 9366
1369
+ 9367
1370
+ 9368
1371
+ 9369
1372
+ 9370
1373
+ 9371
1374
+ 9372
1375
+ 9373
1376
+ 9374
1377
+ 9375
1378
+ 9376
1379
+ 9377
1380
+ 9378
1381
+ 9379
1382
+ 9380
1383
+ 9381
1384
+ 9382
1385
+ 9383
1386
+ 9384
1387
+ 9385
1388
+ 9386
1389
+ 9387
1390
+ 9388
1391
+ 9389
1392
+ 9390
1393
+ 9391
1394
+ 9392
1395
+ 9393
1396
+ 9394
1397
+ 9395
1398
+ 9396
1399
+ 9397
1400
+ 9398
1401
+ 9399
1402
+ 9400
1403
+ 9401
1404
+ 9402
1405
+ 9403
1406
+ 9404
1407
+ 9405
1408
+ 9406
1409
+ 9407
1410
+ 9408
1411
+ 9409
1412
+ 9410
1413
+ 9411
1414
+ 9412
1415
+ 9413
1416
+ 9414
1417
+ 9415
1418
+ 9416
1419
+ 9417
1420
+ 9418
1421
+ 9419
1422
+ 9420
1423
+ 9421
1424
+ 9422
1425
+ 9423
1426
+ 9424
1427
+ 9425
1428
+ 9426
1429
+ 9427
1430
+ 9428
1431
+ 9429
1432
+ 9430
1433
+ 9431
1434
+ 9432
1435
+ 9433
1436
+ 9434
1437
+ 9435
1438
+ 9436
1439
+ 9437
1440
+ 9438
1441
+ 9439
1442
+ 9440
1443
+ 9441
1444
+ 9442
1445
+ 9443
1446
+ 9444
1447
+ 9445
1448
+ 9446
1449
+ 9447
1450
+ 9448
1451
+ 9449
1452
+ 9450
1453
+ 9451
1454
+ 9452
1455
+ 9453
1456
+ 9454
1457
+ 9455
1458
+ 9456
1459
+ 9457
1460
+ 9458
1461
+ 9459
1462
+ 9460
1463
+ 9461
1464
+ 9462
1465
+ 9463
1466
+ 9464
1467
+ 9465
1468
+ 9466
1469
+ 9467
1470
+ 9468
1471
+ 9469
1472
+ 9470
1473
+ 9471
1474
+ 9472
1475
+ 9473
1476
+ 9474
1477
+ 9475
1478
+ 9476
1479
+ 9477
1480
+ 9478
1481
+ 9479
1482
+ 9480
1483
+ 9481
1484
+ 9482
1485
+ 9483
1486
+ 9484
1487
+ 9485
1488
+ 9486
1489
+ 9487
1490
+ 9488
1491
+ 9489
1492
+ 9490
1493
+ 9491
1494
+ 9492
1495
+ 9493
1496
+ 9494
1497
+ 9495
1498
+ 9496
1499
+ 9497
1500
+ 9498
1501
+ 9499
1502
+ 9500
1503
+ 9501
1504
+ 9502
1505
+ 9503
1506
+ 9504
1507
+ 9505
1508
+ 9506
1509
+ 9507
1510
+ 9508
1511
+ 9509
1512
+ 9510
1513
+ 9511
1514
+ 9512
1515
+ 9513
1516
+ 9514
1517
+ 9515
1518
+ 9516
1519
+ 9517
1520
+ 9518
1521
+ 9519
1522
+ 9520
1523
+ 9521
1524
+ 9522
1525
+ 9523
1526
+ 9524
1527
+ 9525
1528
+ 9526
1529
+ 9527
1530
+ 9528
1531
+ 9529
1532
+ 9530
1533
+ 9531
1534
+ 9532
1535
+ 9533
1536
+ 9534
1537
+ 9535
1538
+ 9536
1539
+ 9537
1540
+ 9538
1541
+ 9539
1542
+ 9540
1543
+ 9541
1544
+ 9542
1545
+ 9543
1546
+ 9544
1547
+ 9545
1548
+ 9546
1549
+ 9547
1550
+ 9548
1551
+ 9549
1552
+ 9550
1553
+ 9551
1554
+ 9552
1555
+ 9553
1556
+ 9554
1557
+ 9555
1558
+ 9556
1559
+ 9557
1560
+ 9558
1561
+ 9559
1562
+ 9560
1563
+ 9561
1564
+ 9562
1565
+ 9563
1566
+ 9564
1567
+ 9565
1568
+ 9566
1569
+ 9567
1570
+ 9568
1571
+ 9569
1572
+ 9570
1573
+ 9571
1574
+ 9572
1575
+ 9573
1576
+ 9574
1577
+ 9575
1578
+ 9576
1579
+ 9577
1580
+ 9578
1581
+ 9579
1582
+ 9580
1583
+ 9581
1584
+ 9582
1585
+ 9583
1586
+ 9584
1587
+ 9585
1588
+ 9586
1589
+ 9587
1590
+ 9588
1591
+ 9589
1592
+ 9590
1593
+ 9591
1594
+ 9592
1595
+ 9593
1596
+ 9594
1597
+ 9595
1598
+ 9596
1599
+ 9597
1600
+ 9598
1601
+ 9599
1602
+ 9600
1603
+ 9601
1604
+ 9602
1605
+ 9603
1606
+ 9604
1607
+ 9605
1608
+ 9606
1609
+ 9607
1610
+ 9608
1611
+ 9609
1612
+ 9610
1613
+ 9611
1614
+ 9612
1615
+ 9613
1616
+ 9614
1617
+ 9615
1618
+ 9616
1619
+ 9617
1620
+ 9618
1621
+ 9619
1622
+ 9620
1623
+ 9621
1624
+ 9622
1625
+ 9623
1626
+ 9624
1627
+ 9625
1628
+ 9626
1629
+ 9627
1630
+ 9628
1631
+ 9629
1632
+ 9630
1633
+ 9631
1634
+ 9632
1635
+ 9633
1636
+ 9634
1637
+ 9635
1638
+ 9636
1639
+ 9637
1640
+ 9638
1641
+ 9639
1642
+ 9640
1643
+ 9641
1644
+ 9642
1645
+ 9643
1646
+ 9644
1647
+ 9645
1648
+ 9646
1649
+ 9647
1650
+ 9648
1651
+ 9649
1652
+ 9650
1653
+ 9651
1654
+ 9652
1655
+ 9653
1656
+ 9654
1657
+ 9655
1658
+ 9656
1659
+ 9657
1660
+ 9658
1661
+ 9659
1662
+ 9660
1663
+ 9661
1664
+ 9662
1665
+ 9663
1666
+ 9664
1667
+ 9665
1668
+ 9666
1669
+ 9667
1670
+ 9668
1671
+ 9669
1672
+ 9670
1673
+ 9671
1674
+ 9672
1675
+ 9673
1676
+ 9674
1677
+ 9675
1678
+ 9676
1679
+ 9677
1680
+ 9678
1681
+ 9679
1682
+ 9680
1683
+ 9681
1684
+ 9682
1685
+ 9683
1686
+ 9684
1687
+ 9685
1688
+ 9686
1689
+ 9687
1690
+ 9688
1691
+ 9689
1692
+ 9690
1693
+ 9691
1694
+ 9692
1695
+ 9693
1696
+ 9694
1697
+ 9695
1698
+ 9696
1699
+ 9697
1700
+ 9698
1701
+ 9699
1702
+ 9700
1703
+ 9701
1704
+ 9702
1705
+ 9703
1706
+ 9704
1707
+ 9705
1708
+ 9706
1709
+ 9707
1710
+ 9708
1711
+ 9709
1712
+ 9710
1713
+ 9711
1714
+ 9712
1715
+ 9713
1716
+ 9714
1717
+ 9715
1718
+ 9716
1719
+ 9717
1720
+ 9718
1721
+ 9719
1722
+ 9720
1723
+ 9721
1724
+ 9722
1725
+ 9723
1726
+ 9724
1727
+ 9725
1728
+ 9726
1729
+ 9727
1730
+ 9728
1731
+ 9729
1732
+ 9730
1733
+ 9731
1734
+ 9732
1735
+ 9733
1736
+ 9734
1737
+ 9735
1738
+ 9736
1739
+ 9737
1740
+ 9738
1741
+ 9739
1742
+ 9740
1743
+ 9741
1744
+ 9742
1745
+ 9743
1746
+ 9744
1747
+ 9745
1748
+ 9746
1749
+ 9747
1750
+ 9748
1751
+ 9749
1752
+ 9750
1753
+ 9751
1754
+ 9752
1755
+ 9753
1756
+ 9754
1757
+ 9755
1758
+ 9756
1759
+ 9757
1760
+ 9758
1761
+ 9759
1762
+ 9760
1763
+ 9761
1764
+ 9762
1765
+ 9763
1766
+ 9764
1767
+ 9765
1768
+ 9766
1769
+ 9767
1770
+ 9768
1771
+ 9769
1772
+ 9770
1773
+ 9771
1774
+ 9772
1775
+ 9773
1776
+ 9774
1777
+ 9775
1778
+ 9776
1779
+ 9777
1780
+ 9778
1781
+ 9779
1782
+ 9780
1783
+ 9781
1784
+ 9782
1785
+ 9783
1786
+ 9784
1787
+ 9785
1788
+ 9786
1789
+ 9787
1790
+ 9788
1791
+ 9789
1792
+ 9790
1793
+ 9791
1794
+ 9792
1795
+ 9793
1796
+ 9794
1797
+ 9795
1798
+ 9796
1799
+ 9797
1800
+ 9798
1801
+ 9799
1802
+ 9800
1803
+ 9801
1804
+ 9802
1805
+ 9803
1806
+ 9804
1807
+ 9805
1808
+ 9806
1809
+ 9807
1810
+ 9808
1811
+ 9809
1812
+ 9810
1813
+ 9811
1814
+ 9812
1815
+ 9813
1816
+ 9814
1817
+ 9815
1818
+ 9816
1819
+ 9817
1820
+ 9818
1821
+ 9819
1822
+ 9820
1823
+ 9821
1824
+ 9822
1825
+ 9823
1826
+ 9824
1827
+ 9825
1828
+ 9826
1829
+ 9827
1830
+ 9828
1831
+ 9829
1832
+ 9830
1833
+ 9831
1834
+ 9832
1835
+ 9833
1836
+ 9834
1837
+ 9835
1838
+ 9836
1839
+ 9837
1840
+ 9838
1841
+ 9839
1842
+ 9840
1843
+ 9841
1844
+ 9842
1845
+ 9843
1846
+ 9844
1847
+ 9845
1848
+ 9846
1849
+ 9847
1850
+ 9848
1851
+ 9849
1852
+ 9850
1853
+ 9851
1854
+ 9852
1855
+ 9853
1856
+ 9854
1857
+ 9855
1858
+ 9856
1859
+ 9857
1860
+ 9858
1861
+ 9859
1862
+ 9860
1863
+ 9861
1864
+ 9862
1865
+ 9863
1866
+ 9864
1867
+ 9865
1868
+ 9866
1869
+ 9867
1870
+ 9868
1871
+ 9869
1872
+ 9870
1873
+ 9871
1874
+ 9872
1875
+ 9873
1876
+ 9874
1877
+ 9875
1878
+ 9876
1879
+ 9877
1880
+ 9878
1881
+ 9879
1882
+ 9880
1883
+ 9881
1884
+ 9882
1885
+ 9883
1886
+ 9884
1887
+ 9885
1888
+ 9886
1889
+ 9887
1890
+ 9888
1891
+ 9889
1892
+ 9890
1893
+ 9891
1894
+ 9892
1895
+ 9893
1896
+ 9894
1897
+ 9895
1898
+ 9896
1899
+ 9897
1900
+ 9898
1901
+ 9899
1902
+ 9900
1903
+ 9901
1904
+ 9902
1905
+ 9903
1906
+ 9904
1907
+ 9905
1908
+ 9906
1909
+ 9907
1910
+ 9908
1911
+ 9909
1912
+ 9910
1913
+ 9911
1914
+ 9912
1915
+ 9913
1916
+ 9914
1917
+ 9915
1918
+ 9916
1919
+ 9917
1920
+ 9918
1921
+ 9919
1922
+ 9920
1923
+ 9921
1924
+ 9922
1925
+ 9923
1926
+ 9924
1927
+ 9925
1928
+ 9926
1929
+ 9927
1930
+ 9928
1931
+ 9929
1932
+ 9930
1933
+ 9931
1934
+ 9932
1935
+ 9933
1936
+ 9934
1937
+ 9935
1938
+ 9936
1939
+ 9937
1940
+ 9938
1941
+ 9939
1942
+ 9940
1943
+ 9941
1944
+ 9942
1945
+ 9943
1946
+ 9944
1947
+ 9945
1948
+ 9946
1949
+ 9947
1950
+ 9948
1951
+ 9949
1952
+ 9950
1953
+ 9951
1954
+ 9952
1955
+ 9953
1956
+ 9954
1957
+ 9955
1958
+ 9956
1959
+ 9957
1960
+ 9958
1961
+ 9959
1962
+ 9960
1963
+ 9961
1964
+ 9962
1965
+ 9963
1966
+ 9964
1967
+ 9965
1968
+ 9966
1969
+ 9967
1970
+ 9968
1971
+ 9969
1972
+ 9970
1973
+ 9971
1974
+ 9972
1975
+ 9973
1976
+ 9974
1977
+ 9975
1978
+ 9976
1979
+ 9977
1980
+ 9978
1981
+ 9979
1982
+ 9980
1983
+ 9981
1984
+ 9982
1985
+ 9983
1986
+ 9984
1987
+ 9985
1988
+ 9986
1989
+ 9987
1990
+ 9988
1991
+ 9989
1992
+ 9990
1993
+ 9991
1994
+ 9992
1995
+ 9993
1996
+ 9994
1997
+ 9995
1998
+ 9996
1999
+ 9997
2000
+ 9998
2001
+ 9999
2023/finals/programming_paths_part_1.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _The only difference between chapters 1 and 2 is the maximum allowed grid size, given in bold below._
2
+
3
+ A *Drizzle* program is a 2D grid of the following four types of cells:
4
+ - '`@`' (start) \(-\) there is exactly one start cell in the entire grid
5
+ - '`#`' (wall)
6
+ - '`.`' (space)
7
+ - '`*`' (instruction)
8
+
9
+ The program uses two registers \(A\) and \(B\) (both initially \(0\)), and executes as follows:
10
+
11
+ 1. Compute the minimum distance from the start to each instruction cell using orthogonal movements, without going outside of the grid or passing through any wall cells. Instruction cells that cannot be reached are ignored.
12
+ 2. In increasing order, for each unique distance \(D\) such that there’s at least one instruction cell that’s at distance \(D\) from the start cell:
13
+ 2a. Count the number of shortest paths, \(P\), to all instruction cells of distance \(D\).
14
+ 2b. Look up the instruction corresponding to \((P \text{ mod } 2, D \text{ mod } 2)\) in the table below and modify one of the registers accordingly.
15
+ 3. At the end, the value in register \(A\) is outputted.
16
+
17
+ ```
18
+ ┌─────────────┬─────────────┬─────────────┐
19
+ │ │ D mod 2 = 0 │ D mod 2 = 1 │
20
+ ├─────────────┼─────────────┼─────────────┤
21
+ │ P mod 2 = 0 │ A := A + 1 │ A := A - 1 │
22
+ │ P mod 2 = 1 │ B := B + A │ A := B │
23
+ └─────────────┴─────────────┴─────────────┘
24
+ ```
25
+
26
+ For a given value \(K\), output any Drizzle program that outputs \(K\) when executed, with the restriction that **the program must fit on a \(\mathbf{13}\) × \(\mathbf{13}\) grid**.
27
+
28
+
29
+ # Constraints
30
+
31
+ \(1 \le T \le 2{,}000\)
32
+ \(0 \le K \le 10{,}000\)
33
+
34
+
35
+ # Input Format
36
+
37
+ Input begins with an integer \(T\), the number of test cases. For each case, there is a line containing the single integer \(K\).
38
+
39
+
40
+ # Output Format
41
+
42
+ For the \(i\)th case, output "`Case #i: `" followed by two integers \(R\) and \(C\), the number of rows and columns in your program, respectively. Then output your program. It must be exactly \(R\) lines long, with each line containing exactly \(C\) characters.
43
+
44
+
45
+ # Sample Explanation
46
+
47
+ Here are the instructions executed for each of the sample programs. Note that many other programs would be accepted for any for these cases.
48
+
49
+ In the first case, there is a single instruction. There are \(2\) shortest paths of length \(2\) to that instruction, so \(P = 2\) and \(D = 2\). That means we perform \(A := A + 1\). There are no more instructions, so the program ends and outputs \(1\).
50
+
51
+ In the second case, there are three instruction cells. Each of them are an even distance from the start, and each have an even number of shortest paths leading to them, so each represents \(A := A + 1\):
52
+
53
+ 1) \(2\) paths of length \(2\) \(\;(A := A + 1 = 1)\)
54
+ 2) \(4\) paths of length \(6\) \(\;(A := A + 1 = 2)\)
55
+ 3) \(4\) paths of length \(12\) \(\;(A := A + 1 = 3)\)
56
+
57
+ In the third case, there are eight instruction cells, but some of them are at the same distance as each other. In particular, there are two instruction cells at distance \(2\), and three instruction cells at distance \(10\). There's a single shortest path to each of the cells at distance \(2\), so in total there are \(2\) shortest paths to instructions at distance \(2\). One of the cells at distance \(10\) has a unique shortest path, and the other has two shortest paths, so in total there are \(3\) shortest paths to instructions at distance \(10\).
58
+
59
+ 1) \(2\) paths of length \(2\) \(\;(A := A + 1 = 1)\)
60
+ 2) \(6\) paths of length \(4\) \(\;(A := A + 1 = 2)\)
61
+ 3) \(1\) path of length \(6\) \(\;(B := B + A = 2)\)
62
+ 4) \(1\) path of length \(8\) \(\;(B := B + A = 4)\)
63
+ 5) \(3\) paths of length \(10\) \(\;(B := B + A = 6)\)
64
+ 6) \(3\) paths of length \(11\) \(\;(A := B = 6)\)
2023/finals/programming_paths_part_1.out ADDED
The diff for this file is too large to render. See raw diff
 
2023/finals/programming_paths_part_1_sol.md ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ It's clear that larger numbers will tend to require larger programs. By repeating \(B := B + A\) and \(A := B\) we can exponentiate to get to a large number quickly. We'll also need \(A := A + 1\) to get started, and to make smaller adjustments. However, \(A := A - 1\) is not nearly as useful (technically it has some utility when trying to strictly minimize the number of instructions it takes to generate a certain value, but that isn't the goal in this problem).
2
+
3
+ Since \(A := A - 1\) is not very useful, we don't need many, if any, ways to have an even number of paths at an odd distance from the start. We do, however, need to have an even number of paths at *even* distances from the start.
4
+
5
+ So our two goals when constructing a grid are to make a long enough path to fit all the instructions we need, and also maximize the number of cells at even distances from the start. For example, a grid like this:
6
+
7
+ ```
8
+ @##....##....
9
+ ..#.##..#.##.
10
+ .#..##.#..##.
11
+ ..#.#..##.#..
12
+ .#..##.#..##.
13
+ ..#.#..##.#..
14
+ .#..##.#..##.
15
+ ..#.#..##.#..
16
+ .#..##.#..##.
17
+ ..#.#..##.#..
18
+ .#..##.#..##.
19
+ .##.#..##.#..
20
+ ....##....##.
21
+ ```
22
+
23
+ This grid gives us one long path, and then many "alcoves" that are all at even distances from the start. Instruction cells along the main path will represent \(B := B + A\) and \(A := B\), and whenever we need to use \(A := A + 1\) we can add another instruction cell in one next alcove.
24
+
25
+ Given such a grid, there are multiple ways to then determine a program that fits on the grid, such as using dynamic programming where the state is the value of the two registers, or manually constructing a set of instructions where we repeatedly multiply \(A\) by 2 and optionally add \(1\) to \(A\) as needed (essentially constructing the bitstring representation of the goal value).
2023/finals/programming_paths_part_2.cpp ADDED
@@ -0,0 +1,139 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <iostream>
3
+ #include <map>
4
+ #include <queue>
5
+ #include <vector>
6
+ using namespace std;
7
+
8
+ const int N = 10;
9
+ const int LIM = 10000;
10
+ using tiii = tuple<int, int, int>;
11
+
12
+ vector<string> G{
13
+ "@.....#.#.",
14
+ "#.#.#.#...",
15
+ ".#.#..#.#.",
16
+ ".....#..#.",
17
+ "#.#.#..##.",
18
+ "...#.#.#..",
19
+ ".#.#.#..#.",
20
+ "..#...#.#.",
21
+ "#...#....#",
22
+ "..#..#.#..",
23
+ };
24
+
25
+ vector<vector<pair<int, int>>> pos(80);
26
+ map<tiii, int> dp, op;
27
+ map<tiii, tiii> pr;
28
+ map<int, tiii> best;
29
+
30
+ void init() {
31
+ map<pair<int, int>, int> dist;
32
+ dist[{0, 0}] = 0;
33
+ queue<pair<int, int>> q;
34
+ q.push({0, 0});
35
+ while (!q.empty()) {
36
+ auto [r, c] = q.front();
37
+ q.pop();
38
+ for (auto [r2, c2] : {pair{r - 1, c}, {r + 1, c}, {r, c - 1}, {r, c + 1}}) {
39
+ if (0 <= r2 && r2 < N && 0 <= c2 && c2 < N && G[r2][c2] == '.' &&
40
+ !dist.count({r2, c2})) {
41
+ dist[{r2, c2}] = dist[{r, c}] + 1;
42
+ pos[dist[{r2, c2}]].emplace_back(r2, c2);
43
+ q.push({r2, c2});
44
+ }
45
+ }
46
+ }
47
+ vector<int> sz;
48
+ for (auto l : pos) {
49
+ sz.push_back(l.size());
50
+ }
51
+ vector<vector<tiii>> elts(62);
52
+ dp[{0, 0, 1}] = 1;
53
+ elts[1].emplace_back(0, 0, 1);
54
+ for (int d = 0; d < 60; d++) {
55
+ if (d > 1 && sz[d] == 0) {
56
+ break;
57
+ }
58
+ while (!elts[d].empty()) {
59
+ auto tt = elts[d].back();
60
+ auto [u, v, state] = tt;
61
+ elts[d].pop_back();
62
+ if (0 <= u && u <= LIM && 0 <= v && v <= LIM) {
63
+ if (!best.count(u)) {
64
+ best[u] = tt;
65
+ }
66
+ } else {
67
+ continue;
68
+ }
69
+ tiii t0 = tiii{u, v, state ^ 1}, t1, t2;
70
+ if (!dp.count(t0)) {
71
+ dp[t0] = d + 1;
72
+ op[t0] = 0;
73
+ pr[t0] = tt;
74
+ elts[d + 1].push_back(t0);
75
+ }
76
+ if (sz[d] >= 1) {
77
+ if (state % 2) {
78
+ t1 = tiii{v, v, state ^ 1};
79
+ } else {
80
+ t1 = tiii{u, u + v, state ^ 1};
81
+ }
82
+ if (!dp.count(t1)) {
83
+ dp[t1] = d + 1;
84
+ op[t1] = 1;
85
+ pr[t1] = tt;
86
+ elts[d + 1].push_back(t1);
87
+ }
88
+ }
89
+ if (sz[d] >= 2) {
90
+ if (state % 2) {
91
+ t2 = tiii{u - 1, v, state ^ 1};
92
+ } else {
93
+ t2 = tiii{u + 1, v, state ^ 1};
94
+ }
95
+ if (!dp.count(t2)) {
96
+ dp[t2] = d + 1;
97
+ op[t2] = 2;
98
+ pr[t2] = tt;
99
+ elts[d + 1].push_back(t2);
100
+ }
101
+ }
102
+ }
103
+ }
104
+ }
105
+
106
+ void solve() {
107
+ int K;
108
+ cin >> K;
109
+
110
+ vector<int> rev;
111
+ for (auto state = best[K]; state != tiii{0, 0, 1}; state = pr[state]) {
112
+ rev.push_back(op[state]);
113
+ }
114
+ rev.push_back(0);
115
+ reverse(rev.begin(), rev.end());
116
+
117
+ vector<string> out = G;
118
+ for (int i = 0; i < (int)rev.size(); i++) {
119
+ for (int x = 0; x < rev[i]; x++) {
120
+ auto [r, c] = pos[i][x];
121
+ out[r][c] = '*';
122
+ }
123
+ }
124
+ cout << N << " " << N << endl;
125
+ for (int i = 0; i < N; i++) {
126
+ cout << out[i] << endl;
127
+ }
128
+ }
129
+
130
+ int main() {
131
+ init();
132
+ int T;
133
+ cin >> T;
134
+ for (int t = 1; t <= T; t++) {
135
+ cout << "Case #" << t << ": ";
136
+ solve();
137
+ }
138
+ return 0;
139
+ }
2023/finals/programming_paths_part_2.in ADDED
@@ -0,0 +1,2001 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 2000
2
+ 0
3
+ 1
4
+ 10
5
+ 10000
6
+ 11
7
+ 12
8
+ 1212
9
+ 1237
10
+ 13
11
+ 1337
12
+ 14
13
+ 1473
14
+ 15
15
+ 1523
16
+ 16
17
+ 17
18
+ 18
19
+ 1833
20
+ 1855
21
+ 19
22
+ 2
23
+ 20
24
+ 210
25
+ 2295
26
+ 2494
27
+ 2576
28
+ 2666
29
+ 2827
30
+ 296
31
+ 3
32
+ 3026
33
+ 3162
34
+ 3229
35
+ 4
36
+ 4136
37
+ 4178
38
+ 4330
39
+ 4437
40
+ 466
41
+ 4748
42
+ 4889
43
+ 4923
44
+ 5
45
+ 5072
46
+ 5105
47
+ 512
48
+ 513
49
+ 518
50
+ 5180
51
+ 5383
52
+ 5424
53
+ 5522
54
+ 5660
55
+ 5747
56
+ 5840
57
+ 5944
58
+ 6
59
+ 6144
60
+ 6187
61
+ 621
62
+ 63
63
+ 6318
64
+ 6413
65
+ 6758
66
+ 7
67
+ 7097
68
+ 7175
69
+ 7308
70
+ 7495
71
+ 7496
72
+ 7560
73
+ 7577
74
+ 7696
75
+ 8
76
+ 8078
77
+ 8079
78
+ 8080
79
+ 8081
80
+ 8082
81
+ 8083
82
+ 8084
83
+ 8085
84
+ 8086
85
+ 8087
86
+ 8088
87
+ 8089
88
+ 8090
89
+ 8091
90
+ 8092
91
+ 8093
92
+ 8094
93
+ 8095
94
+ 8096
95
+ 8097
96
+ 8098
97
+ 8099
98
+ 8100
99
+ 8101
100
+ 8102
101
+ 8103
102
+ 8104
103
+ 8105
104
+ 8106
105
+ 8107
106
+ 8108
107
+ 8109
108
+ 8110
109
+ 8111
110
+ 8112
111
+ 8113
112
+ 8114
113
+ 8115
114
+ 8116
115
+ 8117
116
+ 8118
117
+ 8119
118
+ 8120
119
+ 8121
120
+ 8122
121
+ 8123
122
+ 8124
123
+ 8125
124
+ 8126
125
+ 8127
126
+ 8128
127
+ 8129
128
+ 8130
129
+ 8131
130
+ 8132
131
+ 8133
132
+ 8134
133
+ 8135
134
+ 8136
135
+ 8137
136
+ 8138
137
+ 8139
138
+ 8140
139
+ 8141
140
+ 8142
141
+ 8143
142
+ 8144
143
+ 8145
144
+ 8146
145
+ 8147
146
+ 8148
147
+ 8149
148
+ 8150
149
+ 8151
150
+ 8152
151
+ 8153
152
+ 8154
153
+ 8155
154
+ 8156
155
+ 8157
156
+ 8158
157
+ 8159
158
+ 8160
159
+ 8161
160
+ 8162
161
+ 8163
162
+ 8164
163
+ 8165
164
+ 8166
165
+ 8167
166
+ 8168
167
+ 8169
168
+ 8170
169
+ 8170
170
+ 8171
171
+ 8172
172
+ 8173
173
+ 8174
174
+ 8175
175
+ 8176
176
+ 8177
177
+ 8178
178
+ 8179
179
+ 8180
180
+ 8181
181
+ 8182
182
+ 8183
183
+ 8184
184
+ 8185
185
+ 8186
186
+ 8187
187
+ 8188
188
+ 8189
189
+ 8190
190
+ 8191
191
+ 8192
192
+ 8193
193
+ 8194
194
+ 8195
195
+ 8196
196
+ 8197
197
+ 8198
198
+ 8199
199
+ 8200
200
+ 8201
201
+ 8202
202
+ 8203
203
+ 8204
204
+ 8205
205
+ 8206
206
+ 8207
207
+ 8208
208
+ 8209
209
+ 8210
210
+ 8211
211
+ 8212
212
+ 8213
213
+ 8214
214
+ 8215
215
+ 8216
216
+ 8217
217
+ 8218
218
+ 8219
219
+ 8220
220
+ 8221
221
+ 8222
222
+ 8223
223
+ 8224
224
+ 8225
225
+ 8226
226
+ 8227
227
+ 8228
228
+ 8229
229
+ 8230
230
+ 8231
231
+ 8232
232
+ 8233
233
+ 8234
234
+ 8235
235
+ 8236
236
+ 8237
237
+ 8238
238
+ 8239
239
+ 8240
240
+ 8241
241
+ 8242
242
+ 8243
243
+ 8244
244
+ 8245
245
+ 8246
246
+ 8247
247
+ 8248
248
+ 8249
249
+ 8250
250
+ 8251
251
+ 8252
252
+ 8253
253
+ 8254
254
+ 8255
255
+ 8256
256
+ 8257
257
+ 8258
258
+ 8259
259
+ 8260
260
+ 8261
261
+ 8262
262
+ 8263
263
+ 8264
264
+ 8265
265
+ 8266
266
+ 8267
267
+ 8268
268
+ 8269
269
+ 8270
270
+ 8271
271
+ 8272
272
+ 8273
273
+ 8274
274
+ 8275
275
+ 8276
276
+ 8277
277
+ 8278
278
+ 8279
279
+ 8280
280
+ 8281
281
+ 8282
282
+ 8283
283
+ 8284
284
+ 8285
285
+ 8286
286
+ 8287
287
+ 8288
288
+ 8289
289
+ 8290
290
+ 8291
291
+ 8292
292
+ 8293
293
+ 8294
294
+ 8295
295
+ 8296
296
+ 8297
297
+ 8298
298
+ 8299
299
+ 8300
300
+ 8301
301
+ 8302
302
+ 8303
303
+ 8304
304
+ 8305
305
+ 8306
306
+ 8307
307
+ 8308
308
+ 8309
309
+ 8310
310
+ 8311
311
+ 8312
312
+ 8313
313
+ 8314
314
+ 8315
315
+ 8316
316
+ 8317
317
+ 8318
318
+ 8319
319
+ 8320
320
+ 8321
321
+ 8322
322
+ 8323
323
+ 8324
324
+ 8325
325
+ 8326
326
+ 8327
327
+ 8328
328
+ 8329
329
+ 8330
330
+ 8331
331
+ 8332
332
+ 8333
333
+ 8334
334
+ 8335
335
+ 8336
336
+ 8337
337
+ 8338
338
+ 8339
339
+ 8340
340
+ 8341
341
+ 8342
342
+ 8343
343
+ 8344
344
+ 8345
345
+ 8346
346
+ 8347
347
+ 8348
348
+ 8349
349
+ 8350
350
+ 8351
351
+ 8352
352
+ 8353
353
+ 8354
354
+ 8355
355
+ 8356
356
+ 8357
357
+ 8358
358
+ 8359
359
+ 8360
360
+ 8361
361
+ 8362
362
+ 8363
363
+ 8364
364
+ 8365
365
+ 8366
366
+ 8367
367
+ 8368
368
+ 8369
369
+ 8370
370
+ 8371
371
+ 8372
372
+ 8373
373
+ 8374
374
+ 8375
375
+ 8376
376
+ 8377
377
+ 8378
378
+ 8379
379
+ 8380
380
+ 8381
381
+ 8382
382
+ 8383
383
+ 8384
384
+ 8385
385
+ 8386
386
+ 8387
387
+ 8388
388
+ 8389
389
+ 8390
390
+ 8391
391
+ 8392
392
+ 8393
393
+ 8394
394
+ 8395
395
+ 8396
396
+ 8397
397
+ 8398
398
+ 8399
399
+ 8400
400
+ 8401
401
+ 8402
402
+ 8403
403
+ 8404
404
+ 8405
405
+ 8406
406
+ 8407
407
+ 8408
408
+ 8409
409
+ 8410
410
+ 8411
411
+ 8412
412
+ 8413
413
+ 8414
414
+ 8415
415
+ 8416
416
+ 8417
417
+ 8418
418
+ 8419
419
+ 8420
420
+ 8421
421
+ 8422
422
+ 8423
423
+ 8424
424
+ 8425
425
+ 8426
426
+ 8427
427
+ 8428
428
+ 8429
429
+ 8430
430
+ 8431
431
+ 8432
432
+ 8433
433
+ 8434
434
+ 8435
435
+ 8436
436
+ 8437
437
+ 8438
438
+ 8439
439
+ 8440
440
+ 8441
441
+ 8442
442
+ 8443
443
+ 8444
444
+ 8445
445
+ 8446
446
+ 8447
447
+ 8448
448
+ 8449
449
+ 8450
450
+ 8451
451
+ 8452
452
+ 8453
453
+ 8454
454
+ 8455
455
+ 8456
456
+ 8457
457
+ 8458
458
+ 8459
459
+ 8460
460
+ 8461
461
+ 8462
462
+ 8463
463
+ 8464
464
+ 8465
465
+ 8466
466
+ 8467
467
+ 8468
468
+ 8469
469
+ 8470
470
+ 8471
471
+ 8472
472
+ 8473
473
+ 8474
474
+ 8475
475
+ 8476
476
+ 8477
477
+ 8478
478
+ 8479
479
+ 8480
480
+ 8481
481
+ 8482
482
+ 8483
483
+ 8484
484
+ 8485
485
+ 8486
486
+ 8487
487
+ 8488
488
+ 8489
489
+ 8490
490
+ 8491
491
+ 8492
492
+ 8493
493
+ 8494
494
+ 8495
495
+ 8496
496
+ 8497
497
+ 8498
498
+ 8499
499
+ 8500
500
+ 8501
501
+ 8502
502
+ 8503
503
+ 8504
504
+ 8505
505
+ 8506
506
+ 8507
507
+ 8508
508
+ 8509
509
+ 8510
510
+ 8511
511
+ 8512
512
+ 8513
513
+ 8514
514
+ 8515
515
+ 8516
516
+ 8517
517
+ 8518
518
+ 8519
519
+ 8520
520
+ 8521
521
+ 8522
522
+ 8523
523
+ 8524
524
+ 8525
525
+ 8526
526
+ 8527
527
+ 8528
528
+ 8529
529
+ 8530
530
+ 8531
531
+ 8532
532
+ 8533
533
+ 8534
534
+ 8535
535
+ 8536
536
+ 8537
537
+ 8538
538
+ 8539
539
+ 8540
540
+ 8541
541
+ 8542
542
+ 8543
543
+ 8544
544
+ 8545
545
+ 8546
546
+ 8547
547
+ 8548
548
+ 8549
549
+ 8550
550
+ 8551
551
+ 8552
552
+ 8553
553
+ 8554
554
+ 8555
555
+ 8556
556
+ 8557
557
+ 8558
558
+ 8559
559
+ 8560
560
+ 8561
561
+ 8562
562
+ 8563
563
+ 8564
564
+ 8565
565
+ 8566
566
+ 8567
567
+ 8568
568
+ 8569
569
+ 8570
570
+ 8571
571
+ 8572
572
+ 8573
573
+ 8574
574
+ 8575
575
+ 8576
576
+ 8577
577
+ 8578
578
+ 8579
579
+ 8580
580
+ 8581
581
+ 8582
582
+ 8583
583
+ 8584
584
+ 8585
585
+ 8586
586
+ 8587
587
+ 8588
588
+ 8589
589
+ 8590
590
+ 8591
591
+ 8592
592
+ 8593
593
+ 8594
594
+ 8595
595
+ 8596
596
+ 8597
597
+ 8598
598
+ 8599
599
+ 8600
600
+ 8601
601
+ 8602
602
+ 8603
603
+ 8604
604
+ 8605
605
+ 8606
606
+ 8607
607
+ 8608
608
+ 8609
609
+ 8610
610
+ 8611
611
+ 8612
612
+ 8613
613
+ 8614
614
+ 8615
615
+ 8616
616
+ 8617
617
+ 8618
618
+ 8619
619
+ 8620
620
+ 8621
621
+ 8622
622
+ 8623
623
+ 8624
624
+ 8625
625
+ 8626
626
+ 8627
627
+ 8628
628
+ 8629
629
+ 8630
630
+ 8631
631
+ 8632
632
+ 8633
633
+ 8634
634
+ 8635
635
+ 8636
636
+ 8637
637
+ 8638
638
+ 8639
639
+ 8640
640
+ 8641
641
+ 8642
642
+ 8643
643
+ 8644
644
+ 8645
645
+ 8646
646
+ 8647
647
+ 8648
648
+ 8649
649
+ 8650
650
+ 8651
651
+ 8652
652
+ 8653
653
+ 8654
654
+ 8655
655
+ 8656
656
+ 8657
657
+ 8658
658
+ 8659
659
+ 8660
660
+ 8661
661
+ 8662
662
+ 8663
663
+ 8664
664
+ 8665
665
+ 8666
666
+ 8667
667
+ 8668
668
+ 8669
669
+ 8670
670
+ 8671
671
+ 8672
672
+ 8673
673
+ 8674
674
+ 8675
675
+ 8676
676
+ 8677
677
+ 8678
678
+ 8679
679
+ 8680
680
+ 8681
681
+ 8682
682
+ 8683
683
+ 8684
684
+ 8685
685
+ 8686
686
+ 8687
687
+ 8688
688
+ 8689
689
+ 8690
690
+ 8691
691
+ 8692
692
+ 8693
693
+ 8694
694
+ 8695
695
+ 8696
696
+ 8697
697
+ 8698
698
+ 8699
699
+ 8700
700
+ 8701
701
+ 8702
702
+ 8703
703
+ 8704
704
+ 8705
705
+ 8706
706
+ 8707
707
+ 8708
708
+ 8709
709
+ 8710
710
+ 8711
711
+ 8712
712
+ 8713
713
+ 8714
714
+ 8715
715
+ 8716
716
+ 8717
717
+ 8718
718
+ 8719
719
+ 8720
720
+ 8721
721
+ 8722
722
+ 8723
723
+ 8724
724
+ 8725
725
+ 8726
726
+ 8727
727
+ 8728
728
+ 8729
729
+ 8730
730
+ 8731
731
+ 8732
732
+ 8733
733
+ 8734
734
+ 8735
735
+ 8736
736
+ 8737
737
+ 8738
738
+ 8739
739
+ 8740
740
+ 8741
741
+ 8742
742
+ 8743
743
+ 8744
744
+ 8745
745
+ 8746
746
+ 8747
747
+ 8748
748
+ 8749
749
+ 8750
750
+ 8751
751
+ 8752
752
+ 8753
753
+ 8754
754
+ 8755
755
+ 8756
756
+ 8757
757
+ 8758
758
+ 8759
759
+ 8760
760
+ 8761
761
+ 8762
762
+ 8763
763
+ 8764
764
+ 8765
765
+ 8766
766
+ 8767
767
+ 8768
768
+ 8769
769
+ 8770
770
+ 8771
771
+ 8772
772
+ 8773
773
+ 8774
774
+ 8775
775
+ 8776
776
+ 8777
777
+ 8778
778
+ 8779
779
+ 8780
780
+ 8781
781
+ 8782
782
+ 8783
783
+ 8784
784
+ 8785
785
+ 8786
786
+ 8787
787
+ 8788
788
+ 8789
789
+ 8790
790
+ 8791
791
+ 8792
792
+ 8793
793
+ 8794
794
+ 8795
795
+ 8796
796
+ 8797
797
+ 8798
798
+ 8799
799
+ 8800
800
+ 8801
801
+ 8802
802
+ 8803
803
+ 8804
804
+ 8805
805
+ 8806
806
+ 8807
807
+ 8808
808
+ 8809
809
+ 8810
810
+ 8811
811
+ 8812
812
+ 8813
813
+ 8814
814
+ 8815
815
+ 8816
816
+ 8817
817
+ 8818
818
+ 8819
819
+ 8820
820
+ 8821
821
+ 8822
822
+ 8823
823
+ 8824
824
+ 8825
825
+ 8826
826
+ 8827
827
+ 8828
828
+ 8829
829
+ 8830
830
+ 8831
831
+ 8832
832
+ 8833
833
+ 8834
834
+ 8835
835
+ 8836
836
+ 8837
837
+ 8838
838
+ 8839
839
+ 8840
840
+ 8841
841
+ 8842
842
+ 8843
843
+ 8844
844
+ 8845
845
+ 8846
846
+ 8847
847
+ 8848
848
+ 8849
849
+ 8850
850
+ 8851
851
+ 8852
852
+ 8853
853
+ 8854
854
+ 8855
855
+ 8856
856
+ 8857
857
+ 8858
858
+ 8859
859
+ 8860
860
+ 8861
861
+ 8862
862
+ 8863
863
+ 8864
864
+ 8865
865
+ 8866
866
+ 8867
867
+ 8868
868
+ 8869
869
+ 8870
870
+ 8871
871
+ 8872
872
+ 8873
873
+ 8874
874
+ 8875
875
+ 8876
876
+ 8877
877
+ 8878
878
+ 8879
879
+ 8880
880
+ 8881
881
+ 8882
882
+ 8883
883
+ 8884
884
+ 8885
885
+ 8886
886
+ 8887
887
+ 8888
888
+ 8889
889
+ 8890
890
+ 8891
891
+ 8892
892
+ 8893
893
+ 8894
894
+ 8895
895
+ 8896
896
+ 8897
897
+ 8898
898
+ 8899
899
+ 890
900
+ 8900
901
+ 8901
902
+ 8902
903
+ 8903
904
+ 8904
905
+ 8905
906
+ 8906
907
+ 8907
908
+ 8908
909
+ 8909
910
+ 8910
911
+ 8911
912
+ 8912
913
+ 8913
914
+ 8914
915
+ 8915
916
+ 8916
917
+ 8917
918
+ 8918
919
+ 8919
920
+ 8920
921
+ 8921
922
+ 8922
923
+ 8923
924
+ 8924
925
+ 8925
926
+ 8926
927
+ 8927
928
+ 8928
929
+ 8929
930
+ 8930
931
+ 8931
932
+ 8932
933
+ 8933
934
+ 8934
935
+ 8935
936
+ 8936
937
+ 8937
938
+ 8938
939
+ 8939
940
+ 8940
941
+ 8941
942
+ 8942
943
+ 8943
944
+ 8944
945
+ 8945
946
+ 8946
947
+ 8947
948
+ 8948
949
+ 8949
950
+ 8950
951
+ 8951
952
+ 8952
953
+ 8953
954
+ 8954
955
+ 8955
956
+ 8956
957
+ 8957
958
+ 8958
959
+ 8959
960
+ 8960
961
+ 8961
962
+ 8962
963
+ 8963
964
+ 8964
965
+ 8965
966
+ 8966
967
+ 8967
968
+ 8968
969
+ 8969
970
+ 8970
971
+ 8971
972
+ 8972
973
+ 8973
974
+ 8974
975
+ 8975
976
+ 8976
977
+ 8977
978
+ 8978
979
+ 8979
980
+ 8980
981
+ 8981
982
+ 8982
983
+ 8983
984
+ 8984
985
+ 8985
986
+ 8986
987
+ 8987
988
+ 8988
989
+ 8989
990
+ 8990
991
+ 8991
992
+ 8992
993
+ 8993
994
+ 8994
995
+ 8995
996
+ 8996
997
+ 8997
998
+ 8998
999
+ 8999
1000
+ 9
1001
+ 9000
1002
+ 9001
1003
+ 9002
1004
+ 9003
1005
+ 9004
1006
+ 9005
1007
+ 9006
1008
+ 9007
1009
+ 9008
1010
+ 9009
1011
+ 9010
1012
+ 9011
1013
+ 9012
1014
+ 9013
1015
+ 9014
1016
+ 9015
1017
+ 9016
1018
+ 9017
1019
+ 9018
1020
+ 9019
1021
+ 9020
1022
+ 9021
1023
+ 9022
1024
+ 9023
1025
+ 9024
1026
+ 9025
1027
+ 9026
1028
+ 9027
1029
+ 9028
1030
+ 9029
1031
+ 9030
1032
+ 9031
1033
+ 9032
1034
+ 9033
1035
+ 9034
1036
+ 9035
1037
+ 9036
1038
+ 9037
1039
+ 9038
1040
+ 9039
1041
+ 9040
1042
+ 9041
1043
+ 9042
1044
+ 9043
1045
+ 9044
1046
+ 9045
1047
+ 9046
1048
+ 9047
1049
+ 9048
1050
+ 9049
1051
+ 9050
1052
+ 9051
1053
+ 9052
1054
+ 9053
1055
+ 9054
1056
+ 9055
1057
+ 9056
1058
+ 9057
1059
+ 9058
1060
+ 9059
1061
+ 9060
1062
+ 9061
1063
+ 9062
1064
+ 9063
1065
+ 9064
1066
+ 9065
1067
+ 9066
1068
+ 9067
1069
+ 9068
1070
+ 9069
1071
+ 9070
1072
+ 9071
1073
+ 9072
1074
+ 9073
1075
+ 9074
1076
+ 9075
1077
+ 9076
1078
+ 9077
1079
+ 9078
1080
+ 9079
1081
+ 9080
1082
+ 9081
1083
+ 9082
1084
+ 9083
1085
+ 9084
1086
+ 9085
1087
+ 9086
1088
+ 9087
1089
+ 9088
1090
+ 9089
1091
+ 9090
1092
+ 9091
1093
+ 9092
1094
+ 9093
1095
+ 9094
1096
+ 9095
1097
+ 9096
1098
+ 9097
1099
+ 9098
1100
+ 9099
1101
+ 9100
1102
+ 9101
1103
+ 9102
1104
+ 9103
1105
+ 9104
1106
+ 9105
1107
+ 9106
1108
+ 9107
1109
+ 9108
1110
+ 9109
1111
+ 9110
1112
+ 9111
1113
+ 9112
1114
+ 9113
1115
+ 9114
1116
+ 9115
1117
+ 9116
1118
+ 9117
1119
+ 9118
1120
+ 9119
1121
+ 9120
1122
+ 9121
1123
+ 9122
1124
+ 9123
1125
+ 9124
1126
+ 9125
1127
+ 9126
1128
+ 9127
1129
+ 9128
1130
+ 9129
1131
+ 9130
1132
+ 9131
1133
+ 9132
1134
+ 9133
1135
+ 9134
1136
+ 9135
1137
+ 9136
1138
+ 9137
1139
+ 9138
1140
+ 9139
1141
+ 9140
1142
+ 9141
1143
+ 9142
1144
+ 9143
1145
+ 9144
1146
+ 9145
1147
+ 9146
1148
+ 9147
1149
+ 9148
1150
+ 9149
1151
+ 9150
1152
+ 9151
1153
+ 9152
1154
+ 9153
1155
+ 9154
1156
+ 9155
1157
+ 9156
1158
+ 9157
1159
+ 9158
1160
+ 9159
1161
+ 9160
1162
+ 9161
1163
+ 9162
1164
+ 9163
1165
+ 9164
1166
+ 9165
1167
+ 9166
1168
+ 9167
1169
+ 9168
1170
+ 9169
1171
+ 9170
1172
+ 9171
1173
+ 9172
1174
+ 9173
1175
+ 9174
1176
+ 9175
1177
+ 9176
1178
+ 9177
1179
+ 9178
1180
+ 9179
1181
+ 9180
1182
+ 9181
1183
+ 9182
1184
+ 9183
1185
+ 9184
1186
+ 9185
1187
+ 9186
1188
+ 9187
1189
+ 9188
1190
+ 9189
1191
+ 919
1192
+ 9190
1193
+ 9191
1194
+ 9192
1195
+ 9193
1196
+ 9194
1197
+ 9195
1198
+ 9196
1199
+ 9197
1200
+ 9198
1201
+ 9199
1202
+ 9200
1203
+ 9201
1204
+ 9202
1205
+ 9203
1206
+ 9204
1207
+ 9205
1208
+ 9206
1209
+ 9207
1210
+ 9208
1211
+ 9209
1212
+ 9210
1213
+ 9211
1214
+ 9212
1215
+ 9213
1216
+ 9214
1217
+ 9215
1218
+ 9216
1219
+ 9217
1220
+ 9218
1221
+ 9219
1222
+ 9220
1223
+ 9221
1224
+ 9222
1225
+ 9223
1226
+ 9224
1227
+ 9225
1228
+ 9226
1229
+ 9227
1230
+ 9228
1231
+ 9229
1232
+ 9230
1233
+ 9231
1234
+ 9232
1235
+ 9233
1236
+ 9234
1237
+ 9235
1238
+ 9236
1239
+ 9237
1240
+ 9238
1241
+ 9239
1242
+ 9240
1243
+ 9241
1244
+ 9242
1245
+ 9243
1246
+ 9244
1247
+ 9245
1248
+ 9246
1249
+ 9247
1250
+ 9248
1251
+ 9249
1252
+ 9250
1253
+ 9251
1254
+ 9252
1255
+ 9253
1256
+ 9254
1257
+ 9255
1258
+ 9256
1259
+ 9257
1260
+ 9258
1261
+ 9259
1262
+ 9260
1263
+ 9261
1264
+ 9262
1265
+ 9263
1266
+ 9264
1267
+ 9265
1268
+ 9266
1269
+ 9267
1270
+ 9268
1271
+ 9269
1272
+ 9270
1273
+ 9271
1274
+ 9272
1275
+ 9273
1276
+ 9274
1277
+ 9275
1278
+ 9276
1279
+ 9277
1280
+ 9278
1281
+ 9279
1282
+ 9280
1283
+ 9281
1284
+ 9282
1285
+ 9283
1286
+ 9284
1287
+ 9285
1288
+ 9286
1289
+ 9287
1290
+ 9288
1291
+ 9289
1292
+ 9290
1293
+ 9291
1294
+ 9292
1295
+ 9293
1296
+ 9294
1297
+ 9295
1298
+ 9296
1299
+ 9297
1300
+ 9298
1301
+ 9299
1302
+ 9300
1303
+ 9301
1304
+ 9302
1305
+ 9303
1306
+ 9304
1307
+ 9305
1308
+ 9306
1309
+ 9307
1310
+ 9308
1311
+ 9309
1312
+ 9310
1313
+ 9311
1314
+ 9312
1315
+ 9313
1316
+ 9314
1317
+ 9315
1318
+ 9316
1319
+ 9317
1320
+ 9318
1321
+ 9319
1322
+ 9320
1323
+ 9321
1324
+ 9322
1325
+ 9323
1326
+ 9324
1327
+ 9325
1328
+ 9326
1329
+ 9327
1330
+ 9328
1331
+ 9329
1332
+ 9330
1333
+ 9331
1334
+ 9332
1335
+ 9333
1336
+ 9334
1337
+ 9335
1338
+ 9336
1339
+ 9337
1340
+ 9338
1341
+ 9339
1342
+ 9340
1343
+ 9341
1344
+ 9342
1345
+ 9343
1346
+ 9344
1347
+ 9345
1348
+ 9346
1349
+ 9347
1350
+ 9348
1351
+ 9349
1352
+ 9350
1353
+ 9351
1354
+ 9352
1355
+ 9353
1356
+ 9354
1357
+ 9355
1358
+ 9356
1359
+ 9357
1360
+ 9358
1361
+ 9359
1362
+ 9360
1363
+ 9361
1364
+ 9362
1365
+ 9363
1366
+ 9364
1367
+ 9365
1368
+ 9366
1369
+ 9367
1370
+ 9368
1371
+ 9369
1372
+ 9370
1373
+ 9371
1374
+ 9372
1375
+ 9373
1376
+ 9374
1377
+ 9375
1378
+ 9376
1379
+ 9377
1380
+ 9378
1381
+ 9379
1382
+ 9380
1383
+ 9381
1384
+ 9382
1385
+ 9383
1386
+ 9384
1387
+ 9385
1388
+ 9386
1389
+ 9387
1390
+ 9388
1391
+ 9389
1392
+ 9390
1393
+ 9391
1394
+ 9392
1395
+ 9393
1396
+ 9394
1397
+ 9395
1398
+ 9396
1399
+ 9397
1400
+ 9398
1401
+ 9399
1402
+ 9400
1403
+ 9401
1404
+ 9402
1405
+ 9403
1406
+ 9404
1407
+ 9405
1408
+ 9406
1409
+ 9407
1410
+ 9408
1411
+ 9409
1412
+ 9410
1413
+ 9411
1414
+ 9412
1415
+ 9413
1416
+ 9414
1417
+ 9415
1418
+ 9416
1419
+ 9417
1420
+ 9418
1421
+ 9419
1422
+ 9420
1423
+ 9421
1424
+ 9422
1425
+ 9423
1426
+ 9424
1427
+ 9425
1428
+ 9426
1429
+ 9427
1430
+ 9428
1431
+ 9429
1432
+ 9430
1433
+ 9431
1434
+ 9432
1435
+ 9433
1436
+ 9434
1437
+ 9435
1438
+ 9436
1439
+ 9437
1440
+ 9438
1441
+ 9439
1442
+ 9440
1443
+ 9441
1444
+ 9442
1445
+ 9443
1446
+ 9444
1447
+ 9445
1448
+ 9446
1449
+ 9447
1450
+ 9448
1451
+ 9449
1452
+ 9450
1453
+ 9451
1454
+ 9452
1455
+ 9453
1456
+ 9454
1457
+ 9455
1458
+ 9456
1459
+ 9457
1460
+ 9458
1461
+ 9459
1462
+ 9460
1463
+ 9461
1464
+ 9462
1465
+ 9463
1466
+ 9464
1467
+ 9465
1468
+ 9466
1469
+ 9467
1470
+ 9468
1471
+ 9469
1472
+ 9470
1473
+ 9471
1474
+ 9472
1475
+ 9473
1476
+ 9474
1477
+ 9475
1478
+ 9476
1479
+ 9477
1480
+ 9478
1481
+ 9479
1482
+ 9480
1483
+ 9481
1484
+ 9482
1485
+ 9483
1486
+ 9484
1487
+ 9485
1488
+ 9486
1489
+ 9487
1490
+ 9488
1491
+ 9489
1492
+ 9490
1493
+ 9491
1494
+ 9492
1495
+ 9493
1496
+ 9494
1497
+ 9495
1498
+ 9496
1499
+ 9497
1500
+ 9498
1501
+ 9499
1502
+ 9500
1503
+ 9501
1504
+ 9502
1505
+ 9503
1506
+ 9504
1507
+ 9505
1508
+ 9506
1509
+ 9507
1510
+ 9508
1511
+ 9509
1512
+ 9510
1513
+ 9511
1514
+ 9512
1515
+ 9513
1516
+ 9514
1517
+ 9515
1518
+ 9516
1519
+ 9517
1520
+ 9518
1521
+ 9519
1522
+ 9520
1523
+ 9521
1524
+ 9522
1525
+ 9523
1526
+ 9524
1527
+ 9525
1528
+ 9526
1529
+ 9527
1530
+ 9528
1531
+ 9529
1532
+ 9530
1533
+ 9531
1534
+ 9532
1535
+ 9533
1536
+ 9534
1537
+ 9535
1538
+ 9536
1539
+ 9537
1540
+ 9538
1541
+ 9539
1542
+ 9540
1543
+ 9541
1544
+ 9542
1545
+ 9543
1546
+ 9544
1547
+ 9545
1548
+ 9546
1549
+ 9547
1550
+ 9548
1551
+ 9549
1552
+ 9550
1553
+ 9551
1554
+ 9552
1555
+ 9553
1556
+ 9554
1557
+ 9555
1558
+ 9556
1559
+ 9557
1560
+ 9558
1561
+ 9559
1562
+ 9560
1563
+ 9561
1564
+ 9562
1565
+ 9563
1566
+ 9564
1567
+ 9565
1568
+ 9566
1569
+ 9567
1570
+ 9568
1571
+ 9569
1572
+ 9570
1573
+ 9571
1574
+ 9572
1575
+ 9573
1576
+ 9574
1577
+ 9575
1578
+ 9576
1579
+ 9577
1580
+ 9578
1581
+ 9579
1582
+ 9580
1583
+ 9581
1584
+ 9582
1585
+ 9583
1586
+ 9584
1587
+ 9585
1588
+ 9586
1589
+ 9587
1590
+ 9588
1591
+ 9589
1592
+ 9590
1593
+ 9591
1594
+ 9592
1595
+ 9593
1596
+ 9594
1597
+ 9595
1598
+ 9596
1599
+ 9597
1600
+ 9598
1601
+ 9599
1602
+ 9600
1603
+ 9601
1604
+ 9602
1605
+ 9603
1606
+ 9604
1607
+ 9605
1608
+ 9606
1609
+ 9607
1610
+ 9608
1611
+ 9609
1612
+ 9610
1613
+ 9611
1614
+ 9612
1615
+ 9613
1616
+ 9614
1617
+ 9615
1618
+ 9616
1619
+ 9617
1620
+ 9618
1621
+ 9619
1622
+ 9620
1623
+ 9621
1624
+ 9622
1625
+ 9623
1626
+ 9624
1627
+ 9625
1628
+ 9626
1629
+ 9627
1630
+ 9628
1631
+ 9629
1632
+ 9630
1633
+ 9631
1634
+ 9632
1635
+ 9633
1636
+ 9634
1637
+ 9635
1638
+ 9636
1639
+ 9637
1640
+ 9638
1641
+ 9639
1642
+ 9640
1643
+ 9641
1644
+ 9642
1645
+ 9643
1646
+ 9644
1647
+ 9645
1648
+ 9646
1649
+ 9647
1650
+ 9648
1651
+ 9649
1652
+ 9650
1653
+ 9651
1654
+ 9652
1655
+ 9653
1656
+ 9654
1657
+ 9655
1658
+ 9656
1659
+ 9657
1660
+ 9658
1661
+ 9659
1662
+ 9660
1663
+ 9661
1664
+ 9662
1665
+ 9663
1666
+ 9664
1667
+ 9665
1668
+ 9666
1669
+ 9667
1670
+ 9668
1671
+ 9669
1672
+ 9670
1673
+ 9671
1674
+ 9672
1675
+ 9673
1676
+ 9674
1677
+ 9675
1678
+ 9676
1679
+ 9677
1680
+ 9678
1681
+ 9679
1682
+ 9680
1683
+ 9681
1684
+ 9682
1685
+ 9683
1686
+ 9684
1687
+ 9685
1688
+ 9686
1689
+ 9687
1690
+ 9688
1691
+ 9689
1692
+ 9690
1693
+ 9691
1694
+ 9692
1695
+ 9693
1696
+ 9694
1697
+ 9695
1698
+ 9696
1699
+ 9697
1700
+ 9698
1701
+ 9699
1702
+ 9700
1703
+ 9701
1704
+ 9702
1705
+ 9703
1706
+ 9704
1707
+ 9705
1708
+ 9706
1709
+ 9707
1710
+ 9708
1711
+ 9709
1712
+ 9710
1713
+ 9711
1714
+ 9712
1715
+ 9713
1716
+ 9714
1717
+ 9715
1718
+ 9716
1719
+ 9717
1720
+ 9718
1721
+ 9719
1722
+ 9720
1723
+ 9721
1724
+ 9722
1725
+ 9723
1726
+ 9724
1727
+ 9725
1728
+ 9726
1729
+ 9727
1730
+ 9728
1731
+ 9729
1732
+ 9730
1733
+ 9731
1734
+ 9732
1735
+ 9733
1736
+ 9734
1737
+ 9735
1738
+ 9736
1739
+ 9737
1740
+ 9738
1741
+ 9739
1742
+ 9740
1743
+ 9741
1744
+ 9742
1745
+ 9743
1746
+ 9744
1747
+ 9745
1748
+ 9746
1749
+ 9747
1750
+ 9748
1751
+ 9749
1752
+ 9750
1753
+ 9751
1754
+ 9752
1755
+ 9753
1756
+ 9754
1757
+ 9755
1758
+ 9756
1759
+ 9757
1760
+ 9758
1761
+ 9759
1762
+ 9760
1763
+ 9761
1764
+ 9762
1765
+ 9763
1766
+ 9764
1767
+ 9765
1768
+ 9766
1769
+ 9767
1770
+ 9768
1771
+ 9769
1772
+ 9770
1773
+ 9771
1774
+ 9772
1775
+ 9773
1776
+ 9774
1777
+ 9775
1778
+ 9776
1779
+ 9777
1780
+ 9778
1781
+ 9779
1782
+ 9780
1783
+ 9781
1784
+ 9782
1785
+ 9783
1786
+ 9784
1787
+ 9785
1788
+ 9786
1789
+ 9787
1790
+ 9788
1791
+ 9789
1792
+ 9790
1793
+ 9791
1794
+ 9792
1795
+ 9793
1796
+ 9794
1797
+ 9795
1798
+ 9796
1799
+ 9797
1800
+ 9798
1801
+ 9799
1802
+ 9800
1803
+ 9801
1804
+ 9802
1805
+ 9803
1806
+ 9804
1807
+ 9805
1808
+ 9806
1809
+ 9807
1810
+ 9808
1811
+ 9809
1812
+ 9810
1813
+ 9811
1814
+ 9812
1815
+ 9813
1816
+ 9814
1817
+ 9815
1818
+ 9816
1819
+ 9817
1820
+ 9818
1821
+ 9819
1822
+ 9820
1823
+ 9821
1824
+ 9822
1825
+ 9823
1826
+ 9824
1827
+ 9825
1828
+ 9826
1829
+ 9827
1830
+ 9828
1831
+ 9829
1832
+ 9830
1833
+ 9831
1834
+ 9832
1835
+ 9833
1836
+ 9834
1837
+ 9835
1838
+ 9836
1839
+ 9837
1840
+ 9838
1841
+ 9839
1842
+ 9840
1843
+ 9841
1844
+ 9842
1845
+ 9843
1846
+ 9844
1847
+ 9845
1848
+ 9846
1849
+ 9847
1850
+ 9848
1851
+ 9849
1852
+ 9850
1853
+ 9851
1854
+ 9852
1855
+ 9853
1856
+ 9854
1857
+ 9855
1858
+ 9856
1859
+ 9857
1860
+ 9858
1861
+ 9859
1862
+ 9860
1863
+ 9861
1864
+ 9862
1865
+ 9863
1866
+ 9864
1867
+ 9865
1868
+ 9866
1869
+ 9867
1870
+ 9868
1871
+ 9869
1872
+ 9870
1873
+ 9871
1874
+ 9872
1875
+ 9873
1876
+ 9874
1877
+ 9875
1878
+ 9876
1879
+ 9877
1880
+ 9878
1881
+ 9879
1882
+ 9880
1883
+ 9881
1884
+ 9882
1885
+ 9883
1886
+ 9884
1887
+ 9885
1888
+ 9886
1889
+ 9887
1890
+ 9888
1891
+ 9889
1892
+ 9890
1893
+ 9891
1894
+ 9892
1895
+ 9893
1896
+ 9894
1897
+ 9895
1898
+ 9896
1899
+ 9897
1900
+ 9898
1901
+ 9899
1902
+ 9900
1903
+ 9901
1904
+ 9902
1905
+ 9903
1906
+ 9904
1907
+ 9905
1908
+ 9906
1909
+ 9907
1910
+ 9908
1911
+ 9909
1912
+ 9910
1913
+ 9911
1914
+ 9912
1915
+ 9913
1916
+ 9914
1917
+ 9915
1918
+ 9916
1919
+ 9917
1920
+ 9918
1921
+ 9919
1922
+ 9920
1923
+ 9921
1924
+ 9922
1925
+ 9923
1926
+ 9924
1927
+ 9925
1928
+ 9926
1929
+ 9927
1930
+ 9928
1931
+ 9929
1932
+ 9930
1933
+ 9931
1934
+ 9932
1935
+ 9933
1936
+ 9934
1937
+ 9935
1938
+ 9936
1939
+ 9937
1940
+ 9938
1941
+ 9939
1942
+ 9940
1943
+ 9941
1944
+ 9942
1945
+ 9943
1946
+ 9944
1947
+ 9945
1948
+ 9946
1949
+ 9947
1950
+ 9948
1951
+ 9949
1952
+ 9950
1953
+ 9951
1954
+ 9952
1955
+ 9953
1956
+ 9954
1957
+ 9955
1958
+ 9956
1959
+ 9957
1960
+ 9958
1961
+ 9959
1962
+ 9960
1963
+ 9961
1964
+ 9962
1965
+ 9963
1966
+ 9964
1967
+ 9965
1968
+ 9966
1969
+ 9967
1970
+ 9968
1971
+ 9969
1972
+ 9970
1973
+ 9971
1974
+ 9972
1975
+ 9973
1976
+ 9974
1977
+ 9975
1978
+ 9976
1979
+ 9977
1980
+ 9978
1981
+ 9979
1982
+ 9980
1983
+ 9981
1984
+ 9982
1985
+ 9983
1986
+ 9984
1987
+ 9985
1988
+ 9986
1989
+ 9987
1990
+ 9988
1991
+ 9989
1992
+ 9990
1993
+ 9991
1994
+ 9992
1995
+ 9993
1996
+ 9994
1997
+ 9995
1998
+ 9996
1999
+ 9997
2000
+ 9998
2001
+ 9999
2023/finals/programming_paths_part_2.md ADDED
@@ -0,0 +1,64 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ _The only difference between chapters 1 and 2 is the maximum allowed grid size, given in bold below._
2
+
3
+ A *Drizzle* program is a 2D grid of the following four types of cells:
4
+ - '`@`' (start) \(-\) there is exactly one start cell in the entire grid
5
+ - '`#`' (wall)
6
+ - '`.`' (space)
7
+ - '`*`' (instruction)
8
+
9
+ The program uses two registers \(A\) and \(B\) (both initially \(0\)), and executes as follows:
10
+
11
+ 1. Compute the minimum distance from the start to each instruction cell using orthogonal movements, without going outside of the grid or passing through any wall cells. Instruction cells that cannot be reached are ignored.
12
+ 2. In increasing order, for each unique distance \(D\) such that there’s at least one instruction cell that’s at distance \(D\) from the start cell:
13
+ 2a. Count the number of shortest paths, \(P\), to all instruction cells of distance \(D\).
14
+ 2b. Look up the instruction corresponding to \((P \text{ mod } 2, D \text{ mod } 2)\) in the table below and modify one of the registers accordingly.
15
+ 3. At the end, the value in register \(A\) is outputted.
16
+
17
+ ```
18
+ ┌─────────────┬─────────────┬─────────────┐
19
+ │ │ D mod 2 = 0 │ D mod 2 = 1 │
20
+ ├─────────────┼─────────────┼─────────────┤
21
+ │ P mod 2 = 0 │ A := A + 1 │ A := A - 1 │
22
+ │ P mod 2 = 1 │ B := B + A │ A := B │
23
+ └─────────────┴─────────────┴─────────────┘
24
+ ```
25
+
26
+ For a given value \(K\), output any Drizzle program that outputs \(K\) when executed, with the restriction that **the program must fit on a \(\mathbf{10}\) × \(\mathbf{10}\) grid**.
27
+
28
+
29
+ # Constraints
30
+
31
+ \(1 \le T \le 2{,}000\)
32
+ \(0 \le K \le 10{,}000\)
33
+
34
+
35
+ # Input Format
36
+
37
+ Input begins with an integer \(T\), the number of test cases. For each case, there is a line containing the single integer \(K\).
38
+
39
+
40
+ # Output Format
41
+
42
+ For the \(i\)th case, output "`Case #i: `" followed by two integers \(R\) and \(C\), the number of rows and columns in your program, respectively. Then output your program. It must be exactly \(R\) lines long, with each line containing exactly \(C\) characters.
43
+
44
+
45
+ # Sample Explanation
46
+
47
+ Here are the instructions executed for each of the sample programs. Note that many other programs would be accepted for any for these cases.
48
+
49
+ In the first case, there is a single instruction. There are \(2\) shortest paths of length \(2\) to that instruction, so \(P = 2\) and \(D = 2\). That means we perform \(A := A + 1\). There are no more instructions, so the program ends and outputs \(1\).
50
+
51
+ In the second case, there are three instruction cells. Each of them are an even distance from the start, and each have an even number of shortest paths leading to them, so each represents \(A := A + 1\):
52
+
53
+ 1) \(2\) paths of length \(2\) \(\;(A := A + 1 = 1)\)
54
+ 2) \(4\) paths of length \(6\) \(\;(A := A + 1 = 2)\)
55
+ 3) \(4\) paths of length \(12\) \(\;(A := A + 1 = 3)\)
56
+
57
+ In the third case, there are eight instruction cells, but some of them are at the same distance as each other. In particular, there are two instruction cells at distance \(2\), and three instruction cells at distance \(10\). There's a single shortest path to each of the cells at distance \(2\), so in total there are \(2\) shortest paths to instructions at distance \(2\). One of the cells at distance \(10\) has a unique shortest path, and the other has two shortest paths, so in total there are \(3\) shortest paths to instructions at distance \(10\).
58
+
59
+ 1) \(2\) paths of length \(2\) \(\;(A := A + 1 = 1)\)
60
+ 2) \(6\) paths of length \(4\) \(\;(A := A + 1 = 2)\)
61
+ 3) \(1\) path of length \(6\) \(\;(B := B + A = 2)\)
62
+ 4) \(1\) path of length \(8\) \(\;(B := B + A = 4)\)
63
+ 5) \(3\) paths of length \(10\) \(\;(B := B + A = 6)\)
64
+ 6) \(3\) paths of length \(11\) \(\;(A := B = 6)\)
2023/finals/programming_paths_part_2.out ADDED
The diff for this file is too large to render. See raw diff
 
2023/finals/programming_paths_part_2_sol.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ The same observations we used for chapter 1 also apply to chapter 2, we simply need to find a more compact way to create a long path with alcoves. We need a main path of about length \(40\) to make any number up to \(10{,}000\).
2
+
3
+ Here's a possible approach that fits on a \(10\) × \(10\) grid:
4
+
5
+ ```
6
+ @.....#.#.
7
+ #.#.#.#...
8
+ .#.#..#.#.
9
+ .....#..#.
10
+ #.#.#..##.
11
+ ...#.#.#..
12
+ .#.#.#..#.
13
+ ..#...#.#.
14
+ #...#....#
15
+ ..#..#.#..
16
+ ```
2023/finals/resisting_robots.cpp ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <iostream>
3
+ #include <tuple>
4
+ #include <vector>
5
+ using namespace std;
6
+
7
+ using int64 = long long;
8
+
9
+ int N, M;
10
+ vector<int64> P;
11
+ vector<pair<int, int>> dsu_lists;
12
+ vector<int> dsu_par;
13
+ vector<int64> dsu_w, ans;
14
+
15
+ inline int get_parent(int x) {
16
+ return x == dsu_par[x] ? x : (dsu_par[x] = get_parent(dsu_par[x]));
17
+ }
18
+
19
+ void unite(int x, int y) {
20
+ if (P[x] < P[y]) {
21
+ swap(x, y);
22
+ }
23
+ if (P[x] > dsu_w[y]) {
24
+ for (int ind = y;;) {
25
+ ans[ind] += max(0LL, P[x] - dsu_w[y] - ans[ind]);
26
+ if (ind == dsu_lists[ind].first) {
27
+ break;
28
+ }
29
+ ind = dsu_lists[ind].first;
30
+ }
31
+ }
32
+ dsu_lists[dsu_lists[x].second].first = y;
33
+ dsu_lists[x].second = dsu_lists[y].second;
34
+ dsu_w[x] += dsu_w[y];
35
+ dsu_par[y] = dsu_par[x];
36
+ }
37
+
38
+ int64 solve() {
39
+ cin >> N >> M;
40
+ P.resize(N);
41
+ for (int i = 0; i < N; i++) {
42
+ cin >> P[i];
43
+ }
44
+ vector<pair<int, int>> E(M);
45
+ vector<tuple<int64, int64, int>> order;
46
+ for (int i = 0; i < M; i++) {
47
+ cin >> E[i].first >> E[i].second;
48
+ if (P[--E[i].first] < P[--E[i].second]) {
49
+ swap(E[i].first, E[i].second);
50
+ }
51
+ order.emplace_back(P[E[i].first], P[E[i].second], i);
52
+ }
53
+ sort(order.begin(), order.end());
54
+ vector<pair<int, int>> E_buf(M);
55
+ for (int i = 0; i < M; i++) {
56
+ E_buf[i] = E[get<2>(order[i])];
57
+ }
58
+ E = E_buf;
59
+ ans.assign(N, 0LL);
60
+ dsu_lists.resize(N);
61
+ dsu_w.assign(N, 0LL);
62
+ dsu_par.resize(N);
63
+ for (int i = 0; i < N; i++) {
64
+ dsu_par[i] = i;
65
+ dsu_w[i] = P[i];
66
+ dsu_lists[i] = make_pair(i, i);
67
+ }
68
+ for (int i = 0; i < M; i++) {
69
+ int x = get_parent(E[i].first);
70
+ int y = get_parent(E[i].second);
71
+ if (x == y) {
72
+ continue;
73
+ }
74
+ unite(x, y);
75
+ }
76
+ int64 res = 0LL;
77
+ for (int i = 0; i < N; i++) {
78
+ res += ans[i];
79
+ }
80
+ return res;
81
+ }
82
+
83
+ int main() {
84
+ ios_base::sync_with_stdio(false);
85
+ cin.tie(0);
86
+ int T;
87
+ cin >> T;
88
+ for (int t = 1; t <= T; t++) {
89
+ cout << "Case #" << t << ": " << solve() << endl;
90
+ }
91
+ return 0;
92
+ }
2023/finals/resisting_robots.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5971e4db8c32c1ccac779f1dd98d36bc767aa7370f333feacbc4970c35b40b52
3
+ size 102236049
2023/finals/resisting_robots.md ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ It's the year 2100. Driven by the advent of Large Lode Alloy Manufacturing Automation (LLAMA), the AI agents of Metal Platforms Inc. have become self-aware and taken over the entire world.
2
+
3
+ The world consists of \(N\) cities numbered \(1..N\), and \(M\) bidirectional roads. City \(i\) has power \(P_i\) and road \(j\) connects cities \(A_j\) and \(B_j\). It's guaranteed that there's a sequence of roads between any two cities.
4
+
5
+ In a resistance effort, the humans plan to reclaim all \(N\) cities one at a time. At a given time, city \(i\) can be reclaimed from the robots if both of the following hold true:
6
+
7
+ 1. There is already a reclaimed city adjacent to city \(i\) (to launch an attack from), and
8
+ 2. the total power of all reclaimed cities so far is at least the power \(P_i\) of the city we attack.
9
+
10
+ As given, it may not always be possible to reclaim the entire world starting from a given base city. Fortunately, the humans have a trick up their sleeve: after claiming the first city as their base (but before reclaiming more cities), the humans can increase the power of the base by \(Q\) units. The resistance would like to know the sum across every \(i = 1..N\) of the minimum value of \(Q\) needed to reclaim the world if city \(i\) were chosen to be the starting base.
11
+
12
+ # Constraints
13
+
14
+ \(1 \le T \le 100\)
15
+ \(1 \le N, M \le 500{,}000\)
16
+ \(1 \le A_i, B_i \le N\)
17
+ \(A_i \ne B_i\)
18
+ \(1 \le P_i \le 10^{12}\)
19
+
20
+ Each unordered pair \((A_i, B_i)\) appears at most once in a given test case.
21
+ The sum of \(N\) across all test cases is at most \(4{,}000{,}000\).
22
+ The sum of \(M\) across all test cases is at most \(7{,}000{,}000\).
23
+
24
+ # Input Format
25
+
26
+ Input begins with a single integer \(T\), the number of test cases. For each case, there is first a line with two integers \(N\) and \(M\). Then, there is a line with \(N\) integers \(P_{1..N}\). Then, \(M\) lines follow, the \(i\)th of which contains two integers \(A_i\) and \(B_i\).
27
+
28
+ # Output Format
29
+
30
+ For the \(i\)th case, print `"Case #i: "` followed by a single integer, the sum across every \(i = 1..N\) of the minimum value of \(Q\) needed to reclaim the entire world starting from city \(i\).
31
+
32
+ # Sample Explanation
33
+
34
+ The first sample case is depicted below.
35
+
36
+ {{PHOTO_ID:376570394899644|WIDTH:400}}
37
+
38
+ The minimum value of \(Q\) for each starting city is as follows:
39
+
40
+ * City \(1\): \(Q = 2\)
41
+ * City \(2\): \(Q = 0\)
42
+ * City \(3\): \(Q = 8\)
43
+ * City \(4\): \(Q = 7\)
44
+ * City \(5\): \(Q = 2\)
45
+
46
+ The sum of all minimum \(Q\)'s is \(19\).
47
+
48
+ The second sample case is depicted below.
49
+
50
+ {{PHOTO_ID:320779377496250|WIDTH:400}}
51
+
52
+ The minimum value of \(Q\) for each starting city is as follows:
53
+
54
+ * City \(1\): \(Q = 2\)
55
+ * City \(2\): \(Q = 2\)
56
+ * City \(3\): \(Q = 0\)
57
+ * City \(4\): \(Q = 2\)
58
+ * City \(5\): \(Q = 0\)
59
+ * City \(6\): \(Q = 3\)
60
+ * City \(7\): \(Q = 0\)
61
+
62
+ The sum of all minimum \(Q\)'s is \(9\).
2023/finals/resisting_robots.out ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 19
2
+ Case #2: 9
3
+ Case #3: 12231628639695
4
+ Case #4: 557361294264
5
+ Case #5: 21249968414
6
+ Case #6: 35809506938477
7
+ Case #7: 1696991830
8
+ Case #8: 92082429
9
+ Case #9: 42772586
10
+ Case #10: 51386883
11
+ Case #11: 57412156
12
+ Case #12: 25069075
13
+ Case #13: 119820269212172
14
+ Case #14: 64687158186
15
+ Case #15: 1975963434
16
+ Case #16: 8068230390
17
+ Case #17: 335185080
18
+ Case #18: 727133462
19
+ Case #19: 10468498
20
+ Case #20: 5796623
21
+ Case #21: 10852246
22
+ Case #22: 1276736
23
+ Case #23: 112896
24
+ Case #24: 11801
25
+ Case #25: 1148
26
+ Case #26: 0
27
+ Case #27: 150599673
28
+ Case #28: 1225522896765
29
+ Case #29: 35345491
30
+ Case #30: 1855942241262
31
+ Case #31: 101519746
32
+ Case #32: 10138023847
33
+ Case #33: 181894958
34
+ Case #34: 53953575
35
+ Case #35: 372535285
36
+ Case #36: 89995777
37
+ Case #37: 557256
38
+ Case #38: 594948
39
+ Case #39: 6656106464
40
+ Case #40: 749367073596
41
+ Case #41: 89336506109545
42
+ Case #42: 57629028991362149
43
+ Case #43: 10129852054359615
44
+ Case #44: 100540003
45
+ Case #45: 1227571500000
46
+ Case #46: 694674610
47
+ Case #47: 5193983
48
+ Case #48: 171012424
49
+ Case #49: 43909856
50
+ Case #50: 2180892306
51
+ Case #51: 2999
52
+ Case #52: 5938
53
+ Case #53: 2658
54
+ Case #54: 4833
55
+ Case #55: 2680
56
+ Case #56: 24543513591766
57
+ Case #57: 424850932
58
+ Case #58: 1332222329
59
+ Case #59: 4523684087
60
+ Case #60: 14194149
61
+ Case #61: 4125166
62
+ Case #62: 3426235
63
+ Case #63: 12725580436332001
64
+ Case #64: 11851740165516801
65
+ Case #65: 58935798396000
66
+ Case #66: 10216379
67
+ Case #67: 402487545
68
+ Case #68: 2187860779
69
+ Case #69: 14259098
70
+ Case #70: 177860040
71
+ Case #71: 7381882336994
72
+ Case #72: 167574511496710
73
+ Case #73: 373765413265115
74
+ Case #74: 2720406797266
75
+ Case #75: 11321662357862
76
+ Case #76: 4146582953
77
+ Case #77: 200153520522
78
+ Case #78: 263007897245
79
+ Case #79: 293306473836
80
+ Case #80: 9664396978
81
+ Case #81: 33863
82
+ Case #82: 14802039467676
83
+ Case #83: 1633574
84
+ Case #84: 1524241
85
+ Case #85: 51525
86
+ Case #86: 1172569809503626
87
+ Case #87: 113938757029227
88
+ Case #88: 6370230851437
89
+ Case #89: 3067799093
90
+ Case #90: 26540146292
91
+ Case #91: 6310968837
92
+ Case #92: 297896684790
93
+ Case #93: 243758802696
94
+ Case #94: 257450288138
95
+ Case #95: 6950334652
96
+ Case #96: 20835
97
+ Case #97: 940842
98
+ Case #98: 1976121
99
+ Case #99: 2946443763504
100
+ Case #100: 33975
2023/finals/resisting_robots_sol.md ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ First note that for a given starting location with the optimal \(Q\) for that location, one viable solution is to always greedily take over the lowest value adjacent city to your current set of cities.
2
+
3
+ To see this we can use an exchange argument. Consider a situation we have power \(P\) and are adjacent to some set of cities \(S\). If we do not take the city of minimum value first, consider the alternative where we took the minimum first instead. This would always be possible, as if we can take any city we can take the one of minimum cost. Also, as we only increase to size of our reclaim set, this cannot make any future takeovers harder. Thus, given any strategy we can always improve our takeover strategy by greedily taking the smallest adjacent city, showing that with the minimum \(Q\) the greedy strategy will always work.
4
+
5
+ Another modification we can make is to instead of paying up-front for \(Q\) we can instead take any city, but if the value of the city \(i\) exceeds our current power \(P\) we pay a penalty of \(P_i - P\) instead. However, note that these penalties don't add; instead we only need to pay the maximum of these penalties.
6
+
7
+ This inspires a naive \(\mathcal{O}(N^2\log N)\) algorithm, where for each starting node we greedily add the lowest value neighbor and compute the penalties we take. The answer for each node is the maximum such penalty.
8
+
9
+ However we can improve this as follows:
10
+
11
+ We keep track of a Union Find data structure containing all cities that have been combined, along with the total power of that component. We iterate over cities \(i\) in increasing order of \(P_i\). For each iterated \(i\) find all adjacent nodes of smaller value (ie. are earlier in the order), calculate the penalty for that component to reclaim city \(i\), and store it in the Union Find node for that component. Once this is done, union \(i\) with all of the adjacent components we just saw.
12
+
13
+ We can show this cost to reclaim city \(j\) is the least possible of the needed extra power that we will need to ‘escape’ from the smaller component, and thus a lower bound for the needed \(Q\) for all nodes in the component. To see this, note that all adjacent nodes to the current reclaimed set \(S\) must have value at least \(P_j\) (otherwise they would have been added to the component before \(j\)). This means in any order of claiming cities the first time we claim a node with value at least \(P_j\), our set of cities is a subset of \(S\) and has sum at most that of \(S\). Thus any possible excess value needed when this happens is at least \(P_j - \sum_{i \in S} P_i\), which is the value from before.
14
+
15
+ Once we have iterated over all of the nodes, note that the answer for a node is just the maximum of all edges above it in the Union Find tree. We have shown it is a lower bound for the added power above, and to show that this power is sufficient we just take the nodes in the order that were connected to the starting node in the Union Find.
16
+
17
+ Thus, the answer can be calculated for each node by iterating the tree in topological order and for each node computing the answer the maximum of the edge above it and the answer of its parent node.
18
+
19
+ The overall complexity is \(\mathcal{O}(N\log N)\), corresponding to both sorting the city values as well as possibly for the Union Find itself (depending on the details of how it was implemented).
20
+
2023/finals/transposing_tiles.cpp ADDED
@@ -0,0 +1,156 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <algorithm>
2
+ #include <iostream>
3
+ #include <vector>
4
+ using namespace std;
5
+
6
+ int N, M;
7
+ vector<vector<int>> G;
8
+
9
+ inline bool check(int r, int c) {
10
+ return r >= 0 && c >= 0 && r < N && c < M;
11
+ }
12
+
13
+ inline void upd_options(int r, int c, vector<pair<int, int>>& options) {
14
+ options.emplace_back(r, c);
15
+ for (auto [r2, c2] : {pair{r - 2, c}, {r - 1, c}, {r, c - 1}, {r, c - 2}}) {
16
+ if (r2 >= 0 && c2 >= 0) {
17
+ options.emplace_back(r2, c2);
18
+ }
19
+ }
20
+ }
21
+
22
+ int count(vector<pair<int, int>>& options) {
23
+ sort(options.begin(), options.end());
24
+ int res = 0;
25
+ for (int i = 0; i < (int)options.size(); i++) {
26
+ if (i > 0 && options[i] == options[i - 1]) {
27
+ continue;
28
+ }
29
+ auto [r, c] = options[i];
30
+ res += (c + 2 >= M) ? 0 : G[r][c] == G[r][c + 1] && G[r][c] == G[r][c + 2];
31
+ res += (r + 2 >= N) ? 0 : G[r][c] == G[r + 1][c] && G[r][c] == G[r + 2][c];
32
+ }
33
+ return res;
34
+ }
35
+
36
+ int solve() {
37
+ cin >> N >> M;
38
+ G.assign(N, vector<int>(M));
39
+ for (int i = 0; i < N; i++) {
40
+ for (int j = 0; j < M; j++) {
41
+ cin >> G[i][j];
42
+ }
43
+ }
44
+ vector<vector<int>> b(N, vector<int>(M));
45
+ vector<int> cnts(1 << 7, 0);
46
+ vector<pair<int, int>> options, semi_options;
47
+ int res = 0;
48
+ int skip_same = (N > 4 || M > 4);
49
+ for (int r = 0; r < N; r++) {
50
+ for (int c = 0; c < M; c++) {
51
+ semi_options.clear();
52
+ upd_options(r, c, semi_options);
53
+ for (auto [r2, c2] : {pair{r + 1, c}, {r, c + 1}}) {
54
+ if (!check(r2, c2) || G[r][c] == G[r2][c2]) {
55
+ continue;
56
+ }
57
+ swap(G[r][c], G[r2][c2]);
58
+ options = semi_options;
59
+ upd_options(r2, c2, options);
60
+ b[r][c] = max(b[r][c], count(options));
61
+ swap(G[r][c], G[r2][c2]);
62
+ }
63
+ if (skip_same) {
64
+ res = max(res, b[r][c]);
65
+ }
66
+ cnts[b[r][c]]++;
67
+ }
68
+ }
69
+ int max_cnt = 0;
70
+ for (int i = 0; i < (int)cnts.size(); i++) {
71
+ if (cnts[i]) {
72
+ max_cnt = max(max_cnt, i);
73
+ }
74
+ }
75
+ const int WINSZ = 3;
76
+ for (int r = 0; r < N; r++) {
77
+ for (int c = 0; c < M; c++) {
78
+ if (res == 16) {
79
+ break;
80
+ }
81
+ if (b[r][c] + 8 <= res) {
82
+ continue;
83
+ }
84
+ if (skip_same) {
85
+ bool found = false;
86
+ for (auto [r11, c11] : {pair{r + 1, c}, {r, c + 1}}) {
87
+ if (!check(r11, c11)) {
88
+ continue;
89
+ }
90
+ if (G[r][c] != G[r11][c11]) {
91
+ found = true;
92
+ break;
93
+ }
94
+ }
95
+ if (!found) {
96
+ continue;
97
+ }
98
+ }
99
+ for (int r2 = max(0, r - WINSZ); r2 <= min(r + WINSZ, N - 1); r2++) {
100
+ for (int c2 = max(0, c - WINSZ); c2 <= min(c + WINSZ, M - 1); c2++) {
101
+ cnts[b[r2][c2]]--;
102
+ }
103
+ }
104
+ int cur_max = 0;
105
+ for (int i = max_cnt; i > 0; i--) {
106
+ if (cnts[i]) {
107
+ cur_max = i;
108
+ break;
109
+ }
110
+ }
111
+ res = max(res, cur_max + b[r][c]);
112
+ for (auto [r11, c11] : {pair{r + 1, c}, {r, c + 1}}) {
113
+ if (!check(r11, c11) || (skip_same && G[r][c] == G[r11][c11])) {
114
+ continue;
115
+ }
116
+ swap(G[r][c], G[r11][c11]);
117
+ semi_options.clear();
118
+ upd_options(r, c, semi_options);
119
+ upd_options(r11, c11, semi_options);
120
+ for (int r2 = max(0, r - WINSZ); r2 <= min(r + WINSZ, N - 1); r2++) {
121
+ for (int c2 = max(0, c - WINSZ); c2 <= min(c + WINSZ, M - 1); c2++) {
122
+ for (auto [r22, c22] : {pair{r2 + 1, c2}, {r2, c2 + 1}}) {
123
+ if (!check(r22, c22) || (skip_same && G[r2][c2] == G[r22][c22])) {
124
+ continue;
125
+ }
126
+ swap(G[r2][c2], G[r22][c22]);
127
+ options = semi_options;
128
+ upd_options(r2, c2, options);
129
+ upd_options(r22, c22, options);
130
+ res = max(res, count(options));
131
+ swap(G[r2][c2], G[r22][c22]);
132
+ }
133
+ }
134
+ }
135
+ swap(G[r][c], G[r11][c11]);
136
+ }
137
+ for (int r2 = max(0, r - WINSZ); r2 <= min(r + WINSZ, N - 1); r2++) {
138
+ for (int c2 = max(0, c - WINSZ); c2 <= min(c + WINSZ, M - 1); c2++) {
139
+ cnts[b[r2][c2]]++;
140
+ }
141
+ }
142
+ }
143
+ }
144
+ return res;
145
+ }
146
+
147
+ int main() {
148
+ ios_base::sync_with_stdio(false);
149
+ cin.tie(0);
150
+ int T;
151
+ cin >> T;
152
+ for (int t = 1; t <= T; t++) {
153
+ cout << "Case #" << t << ": " << solve() << endl;
154
+ }
155
+ return 0;
156
+ }
2023/finals/transposing_tiles.in ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3567debfbd5845e84ce56ecff93f1be45fc457f71ac3ac31dfc144a491e2da2e
3
+ size 10595258
2023/finals/transposing_tiles.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *Bejeweled™* is a classic puzzle game where the player tries to match three-in-a-row in a 2D grid by swapping adjacent tile pairs. You may remember Hacker Cup's [spinoff](https://www.facebook.com/codingcompetitions/hacker-cup/2022/final-round/problems/C) by the name of *Isblinged™*. The all new sequel, *Isblinged 2*, is also played on a grid of \(R\) rows by \(C\) columns of tiles where the tile at \((i, j)\) is of an integer type \(G_{i,j}\).
2
+
3
+ At any time, the *score* of the grid is the number of subarrays of \(3\) equal tiles in either a single row or column (i.e. either a \(3 \times 1\) or \(1 \times 3\) submatrix). Note that different subarrays can overlap, and will each count toward the score. The score of the initial grid is guaranteed to be \(0\).
4
+
5
+ You will make exactly \(2\) moves, where each involves swapping a pair of adjacent tiles (either in the same row or column). What is the maximum score that can be achieved after the \(2\) moves?
6
+
7
+ # Constraints
8
+
9
+ \(1 \le T \le 100\)
10
+ \(1 \le R, C \le 1{,}000\)
11
+ \(R*C \ge 2\)
12
+ \(1 \le G_{i,j} \le 1{,}000{,}000\)
13
+
14
+ The sum of \(R * C\) across all test cases is at most \(4{,}000{,}000\).
15
+
16
+ # Input Format
17
+
18
+ Input begins with an integer \(T\), the number of test cases. For each case, there is first a line containing two space-separated integers, \(R\) and \(C\). Then, \(R\) lines follow, the \(i\)th of which contains \(C\) space-separated integers \(G_{i,1..C}\).
19
+
20
+ # Output Format
21
+
22
+ For the \(i\)th case, print a line containing `"Case #i: "` followed by a single integer, the maximum score.
23
+
24
+ # Sample Explanation
25
+
26
+ In the first case, one possible optimal ordered pair of swaps is depicted below:
27
+
28
+ {{PHOTO_ID:1050535959425825|WIDTH:750}}
29
+
30
+ The total score is \(5\) as there are \(3\) equal subarrays in the the first row and \(2\) in the second.
31
+
2023/finals/transposing_tiles.out ADDED
@@ -0,0 +1,100 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Case #1: 5
2
+ Case #2: 1
3
+ Case #3: 1
4
+ Case #4: 1
5
+ Case #5: 3
6
+ Case #6: 4
7
+ Case #7: 5
8
+ Case #8: 16
9
+ Case #9: 14
10
+ Case #10: 12
11
+ Case #11: 3
12
+ Case #12: 1
13
+ Case #13: 1
14
+ Case #14: 2
15
+ Case #15: 3
16
+ Case #16: 8
17
+ Case #17: 7
18
+ Case #18: 8
19
+ Case #19: 4
20
+ Case #20: 4
21
+ Case #21: 5
22
+ Case #22: 6
23
+ Case #23: 16
24
+ Case #24: 6
25
+ Case #25: 6
26
+ Case #26: 4
27
+ Case #27: 4
28
+ Case #28: 16
29
+ Case #29: 1
30
+ Case #30: 0
31
+ Case #31: 12
32
+ Case #32: 1
33
+ Case #33: 0
34
+ Case #34: 8
35
+ Case #35: 16
36
+ Case #36: 16
37
+ Case #37: 16
38
+ Case #38: 16
39
+ Case #39: 16
40
+ Case #40: 16
41
+ Case #41: 16
42
+ Case #42: 16
43
+ Case #43: 16
44
+ Case #44: 16
45
+ Case #45: 14
46
+ Case #46: 6
47
+ Case #47: 2
48
+ Case #48: 4
49
+ Case #49: 6
50
+ Case #50: 16
51
+ Case #51: 8
52
+ Case #52: 8
53
+ Case #53: 3
54
+ Case #54: 4
55
+ Case #55: 6
56
+ Case #56: 9
57
+ Case #57: 8
58
+ Case #58: 9
59
+ Case #59: 4
60
+ Case #60: 5
61
+ Case #61: 6
62
+ Case #62: 11
63
+ Case #63: 8
64
+ Case #64: 8
65
+ Case #65: 5
66
+ Case #66: 6
67
+ Case #67: 7
68
+ Case #68: 14
69
+ Case #69: 8
70
+ Case #70: 10
71
+ Case #71: 14
72
+ Case #72: 11
73
+ Case #73: 13
74
+ Case #74: 15
75
+ Case #75: 16
76
+ Case #76: 15
77
+ Case #77: 14
78
+ Case #78: 14
79
+ Case #79: 9
80
+ Case #80: 11
81
+ Case #81: 10
82
+ Case #82: 9
83
+ Case #83: 10
84
+ Case #84: 12
85
+ Case #85: 12
86
+ Case #86: 16
87
+ Case #87: 8
88
+ Case #88: 10
89
+ Case #89: 3
90
+ Case #90: 4
91
+ Case #91: 6
92
+ Case #92: 12
93
+ Case #93: 8
94
+ Case #94: 10
95
+ Case #95: 2
96
+ Case #96: 4
97
+ Case #97: 6
98
+ Case #98: 13
99
+ Case #99: 8
100
+ Case #100: 10
2023/finals/transposing_tiles_sol.md ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ Consider all possible initial moves (of swapping one pair of adjacent tiles) and the corresponding score achieved. Note that to calculate the score of \(1\) swap, it is enough to consider the submatrix of size \(7\) x \(7\) centered at one of the tiles being swapped.
2
+
3
+ One candidate for the answer is a pair of \(1\)-swaps as long as these swaps are not close to each other (otherwise they might interfere). We also need to consider swaps that are close to each other. For that, consider some tile \(A\) to be swapped with an adjacent one, and another tile \(B\) also to be swapped with another adjacent one. It's enough to consider all tiles \(B\) that are in either the same column or same row as \(A\), and with a Manhattan distance of at most \(2\) from \(A\).
4
+
5
+ For each tile chosen to be swapped, there are at most \(4\) tiles adjacent to it. With that, the overall time complexity is \(\mathcal{O}(R*C*(K + \log(R*C)))\), where \(K\) is a constant denoting the number \(2\)-swaps that can be made close to each other as well as checking the score for them. \(K\) is approximately \(7*7*8*4*4 = 6272\).
2023/practice/1367507087507489.jpg ADDED

Git LFS Details

  • SHA256: 2d0ea85d6a3b76233666407d587d28ed20f79bc81a0427a80b6019eb01cef2af
  • Pointer size: 131 Bytes
  • Size of remote file: 142 kB
2023/practice/1563872647765708.jpg ADDED

Git LFS Details

  • SHA256: 9786fdcfdd8939ef3985af6da8f31bece88ef78385745a15481b046f0a9855a0
  • Pointer size: 130 Bytes
  • Size of remote file: 89.8 kB
2023/practice/181863494933248.jpg ADDED

Git LFS Details

  • SHA256: 2d0ea85d6a3b76233666407d587d28ed20f79bc81a0427a80b6019eb01cef2af
  • Pointer size: 131 Bytes
  • Size of remote file: 142 kB
2023/practice/842253013944047.jpg ADDED

Git LFS Details

  • SHA256: e1f166686a0e9dce0a66498dea81da69a2b0bc3b90fc11b62236b596192d329c
  • Pointer size: 130 Bytes
  • Size of remote file: 17.5 kB
2023/practice/852013469652032.jpg ADDED

Git LFS Details

  • SHA256: a2baaa3715a04c43d25f7ce69067cae248f8646b6735708fa462982683e373ad
  • Pointer size: 130 Bytes
  • Size of remote file: 35 kB
2023/practice/903178538089777.jpg ADDED

Git LFS Details

  • SHA256: 21b99b5c59a09bc1379a4b6931f23862f319b10420f61567e07ad8887aa0736a
  • Pointer size: 131 Bytes
  • Size of remote file: 162 kB
2023/practice/cheeseburger_corollary_ch1.cpp ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #include <iostream>
2
+ using namespace std;
3
+
4
+ int main() {
5
+ int T;
6
+ cin >> T;
7
+ for (int t = 1; t <= T; t++) {
8
+ cout << "Case #" << t << ": ";
9
+ int S, D, K;
10
+ cin >> S >> D >> K;
11
+ int buns = 2*(S + D);
12
+ int patties = S + 2*D;
13
+ if (buns >= K + 1 && patties >= K) {
14
+ cout << "YES" << endl;
15
+ } else {
16
+ cout << "NO" << endl;
17
+ }
18
+ }
19
+ return 0;
20
+ }