Implement 2022 day 15 part 1

This commit is contained in:
2022-12-15 18:16:49 +01:00
parent 065fa9cda8
commit 0f64ec4e8f
4 changed files with 147 additions and 3 deletions

View File

@@ -180,6 +180,12 @@ impl IndexSet {
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
pub struct Vec2(pub [i32; 2]);
impl Vec2 {
pub fn l1(self) -> i32 {
self.0.into_iter().map(i32::abs).sum()
}
}
impl Add<Self> for Vec2 {
type Output = Self;