@@ -17,7 +17,6 @@ fn find_shortest_path(
17
17
start : Point ,
18
18
bodies_diff : & [ Point ] ,
19
19
booster_map : & Matrix < Option < BoosterType > > ,
20
- drill_mode : bool ,
21
20
) -> Vec < Move > {
22
21
let mut rng = thread_rng ( ) ;
23
22
let mut moves = [
@@ -46,7 +45,7 @@ fn find_shortest_path(
46
45
} ) ;
47
46
48
47
let is_booster = match booster_map. get ( c) {
49
- Some ( Some ( _ ) ) => true ,
48
+ Some ( Some ( BoosterType :: NewHand ) ) => true ,
50
49
_ => false ,
51
50
} ;
52
51
@@ -74,12 +73,9 @@ fn find_shortest_path(
74
73
for m in & moves {
75
74
let nc = c. move_with ( m) ;
76
75
if let Some ( None ) = data. get ( nc) {
77
- match ( valid. get ( nc) , drill_mode) {
78
- ( Some ( true ) , _) | ( Some ( false ) , true ) => {
79
- data. set ( nc, Some ( ( m. clone ( ) , cost + 1 ) ) ) ;
80
- queue. push_back ( nc) ;
81
- }
82
- _ => { }
76
+ if let Some ( true ) = valid. get ( nc) {
77
+ data. set ( nc, Some ( ( m. clone ( ) , cost + 1 ) ) ) ;
78
+ queue. push_back ( nc) ;
83
79
}
84
80
}
85
81
}
@@ -93,7 +89,6 @@ fn update_point(
93
89
passed : & mut Matrix < bool > ,
94
90
booster_map : & mut Matrix < Option < BoosterType > > ,
95
91
hand_count : & mut usize ,
96
- drill_count : & mut usize ,
97
92
remaining : & mut usize ,
98
93
) {
99
94
bodies_diff. iter ( ) . map ( |diff| point + * diff) . for_each ( |b| {
@@ -105,7 +100,7 @@ fn update_point(
105
100
if let Some ( Some ( kind) ) = booster_map. get ( point) {
106
101
match kind {
107
102
BoosterType :: NewHand => * hand_count += 1 ,
108
- BoosterType :: Drill => * drill_count += 1 ,
103
+ BoosterType :: Drill => { }
109
104
_ => { }
110
105
}
111
106
booster_map. set ( point, None ) ;
@@ -161,7 +156,6 @@ pub fn solve_small(task: Task) -> Vec<Command> {
161
156
] ) ;
162
157
163
158
let mut hand_count = 0 ;
164
- let mut drill_count = 0 ;
165
159
166
160
while remaining > 0 {
167
161
while hand_count > 0 && !new_bodies. is_empty ( ) {
@@ -176,7 +170,6 @@ pub fn solve_small(task: Task) -> Vec<Command> {
176
170
& mut passed,
177
171
& mut booster_map,
178
172
& mut hand_count,
179
- & mut drill_count,
180
173
& mut remaining,
181
174
) ;
182
175
let moves = find_shortest_path (
@@ -187,32 +180,7 @@ pub fn solve_small(task: Task) -> Vec<Command> {
187
180
current_point,
188
181
& bodies_diff,
189
182
& booster_map,
190
- false ,
191
183
) ;
192
- let moves = if drill_count > 0 {
193
- let drill_moves = find_shortest_path (
194
- width,
195
- height,
196
- & valid,
197
- & passed,
198
- current_point,
199
- & bodies_diff,
200
- & booster_map,
201
- true ,
202
- ) ;
203
- if drill_moves. len ( ) * 2 <= moves. len ( )
204
- && drill_moves. len ( ) >= 10
205
- && drill_moves. len ( ) < 30
206
- {
207
- drill_count -= 1 ;
208
- res. push ( Command :: Drill ) ;
209
- drill_moves
210
- } else {
211
- moves
212
- }
213
- } else {
214
- moves
215
- } ;
216
184
for m in moves {
217
185
current_point = current_point. move_with ( & m) ;
218
186
update_point (
@@ -221,7 +189,6 @@ pub fn solve_small(task: Task) -> Vec<Command> {
221
189
& mut passed,
222
190
& mut booster_map,
223
191
& mut hand_count,
224
- & mut drill_count,
225
192
& mut remaining,
226
193
) ;
227
194
res. push ( Command :: Move ( m) ) ;
0 commit comments