@@ 19,10 19,11 @@ fn main() {
.map(|v| (Point(v[0], v[1]), Point(v[2], v[3])))
.collect::<Vec<_>>();
+ let mut by_pos = FxHashMap::default();
for i in 1.. {
+ by_pos.clear();
let mut xp = (1000000i32, -1000000i32);
let mut yp = (1000000i32, -1000000i32);
- let mut by_pos = FxHashMap::default();
for &mut (ref mut pos, ref vel) in &mut input {
*pos += *vel;
@@ 40,6 41,7 @@ fn main() {
println!(" 1:");
for y in yp.0..=yp.1 {
+ print!("\t");
for x in xp.0..=xp.1 {
if let Some(_) = by_pos.remove(&Point(x, y)) {
print!("#");
@@ 47,8 49,7 @@ fn main() {
print!(" ");
}
}
-
- println!("");
+ println!();
}
println!(" 2: {}", i);