Compare commits
No commits in common. "afff8dd79ff2bf244dfb0cded29eba62a3ac2389" and "987760422a1c99d925e25afd2387c810546dd2b0" have entirely different histories.
afff8dd79f
...
987760422a
File diff suppressed because it is too large
Load Diff
@ -1,5 +0,0 @@
|
|||||||
#############
|
|
||||||
#...........#
|
|
||||||
###D#A#C#D###
|
|
||||||
#C#A#B#B#
|
|
||||||
#########
|
|
||||||
@ -1,469 +0,0 @@
|
|||||||
use advent::prelude::*;
|
|
||||||
use aoc_runner_derive::aoc;
|
|
||||||
use std::ops::{Add, Sub};
|
|
||||||
|
|
||||||
#[derive(Clone, Copy, Default, Eq, Hash, PartialEq, PartialOrd, Ord)]
|
|
||||||
struct Vec3([i64; 3]);
|
|
||||||
|
|
||||||
impl Add for Vec3 {
|
|
||||||
type Output = Self;
|
|
||||||
fn add(self, other: Self) -> Self::Output {
|
|
||||||
Vec3([
|
|
||||||
self.0[0] + other.0[0],
|
|
||||||
self.0[1] + other.0[1],
|
|
||||||
self.0[2] + other.0[2],
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Sub for Vec3 {
|
|
||||||
type Output = Self;
|
|
||||||
fn sub(self, other: Self) -> Self::Output {
|
|
||||||
Vec3([
|
|
||||||
self.0[0] - other.0[0],
|
|
||||||
self.0[1] - other.0[1],
|
|
||||||
self.0[2] - other.0[2],
|
|
||||||
])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Debug for Vec3 {
|
|
||||||
fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error> {
|
|
||||||
write!(f, "<{:4},{:4},{:4}>", self.0[0], self.0[1], self.0[2])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromStr for Vec3 {
|
|
||||||
type Err = Infallible;
|
|
||||||
|
|
||||||
fn from_str(input: &str) -> std::result::Result<Vec3, Infallible> {
|
|
||||||
let v: Vec<_> = input.split(',').map(|s| s.parse().unwrap()).collect();
|
|
||||||
Ok(Vec3(v.try_into().unwrap()))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug)]
|
|
||||||
struct Scanner {
|
|
||||||
id: usize,
|
|
||||||
offset: Option<Vec3>,
|
|
||||||
points: Vec<Vec3>,
|
|
||||||
}
|
|
||||||
|
|
||||||
impl Scanner {
|
|
||||||
fn translate(&mut self, distance: Vec3, orientation: [usize; 3], signs: [i64; 3]) {
|
|
||||||
for p in &mut self.points {
|
|
||||||
*p = Vec3([
|
|
||||||
signs[0] * p.0[orientation[0]] + distance.0[0],
|
|
||||||
signs[1] * p.0[orientation[1]] + distance.0[1],
|
|
||||||
signs[2] * p.0[orientation[2]] + distance.0[2],
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl FromStr for Scanner {
|
|
||||||
type Err = Infallible;
|
|
||||||
|
|
||||||
fn from_str(input: &str) -> std::result::Result<Scanner, Infallible> {
|
|
||||||
let mut it = input.lines();
|
|
||||||
let id = it
|
|
||||||
.next()
|
|
||||||
.unwrap()
|
|
||||||
.split(' ')
|
|
||||||
.nth(2)
|
|
||||||
.unwrap()
|
|
||||||
.parse()
|
|
||||||
.unwrap();
|
|
||||||
Ok(Scanner {
|
|
||||||
id,
|
|
||||||
offset: None,
|
|
||||||
points: it.map(|l| l.parse().unwrap()).collect(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, PartialEq)]
|
|
||||||
struct Match {
|
|
||||||
abs_points: Vec<Vec3>,
|
|
||||||
distance: Vec3,
|
|
||||||
orientation: [usize; 3],
|
|
||||||
signs: [i64; 3],
|
|
||||||
}
|
|
||||||
|
|
||||||
// Returns overlap, and in s1 space
|
|
||||||
fn find_overlap(s1: &Scanner, s2: &Scanner) -> Option<Match> {
|
|
||||||
let mut counts: HashMap<(Vec3, [usize; 3], [i64; 3]), Vec<Vec3>> = HashMap::new();
|
|
||||||
let orientations = [
|
|
||||||
[0, 1, 2],
|
|
||||||
[0, 2, 1],
|
|
||||||
[1, 0, 2],
|
|
||||||
[1, 2, 0],
|
|
||||||
[2, 0, 1],
|
|
||||||
[2, 1, 0],
|
|
||||||
];
|
|
||||||
let signs = [
|
|
||||||
[-1, -1, -1],
|
|
||||||
[1, -1, -1],
|
|
||||||
[-1, 1, -1],
|
|
||||||
[1, 1, -1],
|
|
||||||
[-1, -1, 1],
|
|
||||||
[1, -1, 1],
|
|
||||||
[-1, 1, 1],
|
|
||||||
];
|
|
||||||
for v1 in &s1.points {
|
|
||||||
for v2 in &s2.points {
|
|
||||||
for or in orientations {
|
|
||||||
for sign in signs {
|
|
||||||
let [x, y, z] = sign;
|
|
||||||
let v = Vec3([x * v2.0[or[0]], y * v2.0[or[1]], z * v2.0[or[2]]]);
|
|
||||||
let diff = *v1 - v;
|
|
||||||
counts.entry((diff, or, sign)).or_default().push(*v1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if let Some(((distance, orientation, signs), list)) =
|
|
||||||
counts.into_iter().find(|(_k, v)| v.len() >= 12)
|
|
||||||
{
|
|
||||||
// s1's points should already be in absolute coords. s2 will be translated in
|
|
||||||
// part1().
|
|
||||||
return Some(Match {
|
|
||||||
abs_points: list,
|
|
||||||
distance,
|
|
||||||
orientation,
|
|
||||||
signs,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
|
||||||
|
|
||||||
fn parse(input: &str) -> Result<Vec<Scanner>> {
|
|
||||||
input.split("\n\n").map(|s| Ok(s.parse()?)).collect()
|
|
||||||
}
|
|
||||||
#[aoc(day19, part1)]
|
|
||||||
fn part1(input: &str) -> Result<usize> {
|
|
||||||
let mut scanner = parse(input)?;
|
|
||||||
// Assign the first scanner to the origin (0,0,0).
|
|
||||||
// Put that in a list of recently registered scanners.
|
|
||||||
// In a loop
|
|
||||||
// - For each recently registered scanner, attempt to find overlap with each unregistered
|
|
||||||
// scanner.
|
|
||||||
// - Matches should be translated according to the offsets found during the match. This should
|
|
||||||
// put them in absolute space.
|
|
||||||
// - Each match should be added to the recently registered list for the next iteration.
|
|
||||||
// - Do this until all scanners are registered.
|
|
||||||
scanner[0].offset = Some(Vec3::default());
|
|
||||||
let (mut registered, mut unregistered): (VecDeque<_>, VecDeque<_>) =
|
|
||||||
scanner.into_iter().partition(|s| s.offset.is_some());
|
|
||||||
|
|
||||||
let mut becons = HashSet::new();
|
|
||||||
let mut done = Vec::new();
|
|
||||||
while let Some(reg) = registered.pop_front() {
|
|
||||||
let mut unregs = VecDeque::new();
|
|
||||||
for mut unreg in unregistered {
|
|
||||||
if let Some(mat) = find_overlap(®, &unreg) {
|
|
||||||
unreg.offset = Some(mat.distance);
|
|
||||||
unreg.translate(mat.distance, mat.orientation, mat.signs);
|
|
||||||
println!(
|
|
||||||
"scanner {} @ {:?} found {} hits",
|
|
||||||
&unreg.id,
|
|
||||||
&unreg.offset.unwrap(),
|
|
||||||
mat.abs_points.len()
|
|
||||||
);
|
|
||||||
registered.push_back(unreg);
|
|
||||||
for pt in mat.abs_points {
|
|
||||||
becons.insert(pt);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
unregs.push_back(unreg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
done.push(reg);
|
|
||||||
unregistered = unregs;
|
|
||||||
}
|
|
||||||
|
|
||||||
println!("before pass 2: {}", becons.len());
|
|
||||||
for i in 0..registered.len() {
|
|
||||||
for j in i..registered.len() {
|
|
||||||
let s1 = ®istered[i];
|
|
||||||
let s2 = ®istered[j];
|
|
||||||
if let Some(mat) = find_overlap(s1, s2) {
|
|
||||||
for pt in mat.abs_points {
|
|
||||||
becons.insert(pt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
println!("after pass 2: {}", becons.len());
|
|
||||||
|
|
||||||
//assert_eq!(done.len(), 12);
|
|
||||||
let mut becons: Vec<_> = becons.iter().collect();
|
|
||||||
becons.sort();
|
|
||||||
dbg!(&becons);
|
|
||||||
Ok(becons.len())
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#[aoc(day19, part2)]
|
|
||||||
fn part2(input: &str) -> Result<usize> {
|
|
||||||
todo!("part2");
|
|
||||||
Ok(0)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_overlap() -> Result<()> {
|
|
||||||
use pretty_assertions::assert_eq;
|
|
||||||
|
|
||||||
let input = r#"
|
|
||||||
--- scanner 0 ---
|
|
||||||
404,-588,-901
|
|
||||||
528,-643,409
|
|
||||||
-838,591,734
|
|
||||||
390,-675,-793
|
|
||||||
-537,-823,-458
|
|
||||||
-485,-357,347
|
|
||||||
-345,-311,381
|
|
||||||
-661,-816,-575
|
|
||||||
-876,649,763
|
|
||||||
-618,-824,-621
|
|
||||||
553,345,-567
|
|
||||||
474,580,667
|
|
||||||
-447,-329,318
|
|
||||||
-584,868,-557
|
|
||||||
544,-627,-890
|
|
||||||
564,392,-477
|
|
||||||
455,729,728
|
|
||||||
-892,524,684
|
|
||||||
-689,845,-530
|
|
||||||
423,-701,434
|
|
||||||
7,-33,-71
|
|
||||||
630,319,-379
|
|
||||||
443,580,662
|
|
||||||
-789,900,-551
|
|
||||||
459,-707,401
|
|
||||||
|
|
||||||
--- scanner 1 ---
|
|
||||||
686,422,578
|
|
||||||
605,423,415
|
|
||||||
515,917,-361
|
|
||||||
-336,658,858
|
|
||||||
95,138,22
|
|
||||||
-476,619,847
|
|
||||||
-340,-569,-846
|
|
||||||
567,-361,727
|
|
||||||
-460,603,-452
|
|
||||||
669,-402,600
|
|
||||||
729,430,532
|
|
||||||
-500,-761,534
|
|
||||||
-322,571,750
|
|
||||||
-466,-666,-811
|
|
||||||
-429,-592,574
|
|
||||||
-355,545,-477
|
|
||||||
703,-491,-529
|
|
||||||
-328,-685,520
|
|
||||||
413,935,-424
|
|
||||||
-391,539,-444
|
|
||||||
586,-435,557
|
|
||||||
-364,-763,-893
|
|
||||||
807,-499,-711
|
|
||||||
755,-354,-619
|
|
||||||
553,889,-390
|
|
||||||
"#
|
|
||||||
.trim();
|
|
||||||
let mut abs_points: Vec<Vec3> = r#"
|
|
||||||
-618,-824,-621
|
|
||||||
-537,-823,-458
|
|
||||||
-447,-329,318
|
|
||||||
404,-588,-901
|
|
||||||
544,-627,-890
|
|
||||||
528,-643,409
|
|
||||||
-661,-816,-575
|
|
||||||
390,-675,-793
|
|
||||||
423,-701,434
|
|
||||||
-345,-311,381
|
|
||||||
459,-707,401
|
|
||||||
-485,-357,347
|
|
||||||
"#
|
|
||||||
.trim()
|
|
||||||
.lines()
|
|
||||||
.map(|l| l.parse().unwrap())
|
|
||||||
.collect();
|
|
||||||
abs_points.sort();
|
|
||||||
let orientation = [0, 1, 2];
|
|
||||||
let signs = [-1, 1, -1];
|
|
||||||
let distance = Vec3([68, -1246, -43]);
|
|
||||||
let want = Match {
|
|
||||||
distance,
|
|
||||||
abs_points,
|
|
||||||
orientation,
|
|
||||||
signs,
|
|
||||||
};
|
|
||||||
|
|
||||||
let scanners = parse(input)?;
|
|
||||||
let mut got = find_overlap(&scanners[0], &scanners[1]).unwrap();
|
|
||||||
got.abs_points.sort();
|
|
||||||
assert_eq!(want, got);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_part1() -> Result<()> {
|
|
||||||
let input = r#"
|
|
||||||
--- scanner 0 ---
|
|
||||||
404,-588,-901
|
|
||||||
528,-643,409
|
|
||||||
-838,591,734
|
|
||||||
390,-675,-793
|
|
||||||
-537,-823,-458
|
|
||||||
-485,-357,347
|
|
||||||
-345,-311,381
|
|
||||||
-661,-816,-575
|
|
||||||
-876,649,763
|
|
||||||
-618,-824,-621
|
|
||||||
553,345,-567
|
|
||||||
474,580,667
|
|
||||||
-447,-329,318
|
|
||||||
-584,868,-557
|
|
||||||
544,-627,-890
|
|
||||||
564,392,-477
|
|
||||||
455,729,728
|
|
||||||
-892,524,684
|
|
||||||
-689,845,-530
|
|
||||||
423,-701,434
|
|
||||||
7,-33,-71
|
|
||||||
630,319,-379
|
|
||||||
443,580,662
|
|
||||||
-789,900,-551
|
|
||||||
459,-707,401
|
|
||||||
|
|
||||||
--- scanner 1 ---
|
|
||||||
686,422,578
|
|
||||||
605,423,415
|
|
||||||
515,917,-361
|
|
||||||
-336,658,858
|
|
||||||
95,138,22
|
|
||||||
-476,619,847
|
|
||||||
-340,-569,-846
|
|
||||||
567,-361,727
|
|
||||||
-460,603,-452
|
|
||||||
669,-402,600
|
|
||||||
729,430,532
|
|
||||||
-500,-761,534
|
|
||||||
-322,571,750
|
|
||||||
-466,-666,-811
|
|
||||||
-429,-592,574
|
|
||||||
-355,545,-477
|
|
||||||
703,-491,-529
|
|
||||||
-328,-685,520
|
|
||||||
413,935,-424
|
|
||||||
-391,539,-444
|
|
||||||
586,-435,557
|
|
||||||
-364,-763,-893
|
|
||||||
807,-499,-711
|
|
||||||
755,-354,-619
|
|
||||||
553,889,-390
|
|
||||||
|
|
||||||
--- scanner 2 ---
|
|
||||||
649,640,665
|
|
||||||
682,-795,504
|
|
||||||
-784,533,-524
|
|
||||||
-644,584,-595
|
|
||||||
-588,-843,648
|
|
||||||
-30,6,44
|
|
||||||
-674,560,763
|
|
||||||
500,723,-460
|
|
||||||
609,671,-379
|
|
||||||
-555,-800,653
|
|
||||||
-675,-892,-343
|
|
||||||
697,-426,-610
|
|
||||||
578,704,681
|
|
||||||
493,664,-388
|
|
||||||
-671,-858,530
|
|
||||||
-667,343,800
|
|
||||||
571,-461,-707
|
|
||||||
-138,-166,112
|
|
||||||
-889,563,-600
|
|
||||||
646,-828,498
|
|
||||||
640,759,510
|
|
||||||
-630,509,768
|
|
||||||
-681,-892,-333
|
|
||||||
673,-379,-804
|
|
||||||
-742,-814,-386
|
|
||||||
577,-820,562
|
|
||||||
|
|
||||||
--- scanner 3 ---
|
|
||||||
-589,542,597
|
|
||||||
605,-692,669
|
|
||||||
-500,565,-823
|
|
||||||
-660,373,557
|
|
||||||
-458,-679,-417
|
|
||||||
-488,449,543
|
|
||||||
-626,468,-788
|
|
||||||
338,-750,-386
|
|
||||||
528,-832,-391
|
|
||||||
562,-778,733
|
|
||||||
-938,-730,414
|
|
||||||
543,643,-506
|
|
||||||
-524,371,-870
|
|
||||||
407,773,750
|
|
||||||
-104,29,83
|
|
||||||
378,-903,-323
|
|
||||||
-778,-728,485
|
|
||||||
426,699,580
|
|
||||||
-438,-605,-362
|
|
||||||
-469,-447,-387
|
|
||||||
509,732,623
|
|
||||||
647,635,-688
|
|
||||||
-868,-804,481
|
|
||||||
614,-800,639
|
|
||||||
595,780,-596
|
|
||||||
|
|
||||||
--- scanner 4 ---
|
|
||||||
727,592,562
|
|
||||||
-293,-554,779
|
|
||||||
441,611,-461
|
|
||||||
-714,465,-776
|
|
||||||
-743,427,-804
|
|
||||||
-660,-479,-426
|
|
||||||
832,-632,460
|
|
||||||
927,-485,-438
|
|
||||||
408,393,-506
|
|
||||||
466,436,-512
|
|
||||||
110,16,151
|
|
||||||
-258,-428,682
|
|
||||||
-393,719,612
|
|
||||||
-211,-452,876
|
|
||||||
808,-476,-593
|
|
||||||
-575,615,604
|
|
||||||
-485,667,467
|
|
||||||
-680,325,-822
|
|
||||||
-627,-443,-432
|
|
||||||
872,-547,-609
|
|
||||||
833,512,582
|
|
||||||
807,604,487
|
|
||||||
839,-516,451
|
|
||||||
891,-625,532
|
|
||||||
-652,-548,-490
|
|
||||||
30,-46,-14
|
|
||||||
"#
|
|
||||||
.trim();
|
|
||||||
assert_eq!(part1(input)?, 79);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#[test]
|
|
||||||
fn test_part2()->Result<()> {
|
|
||||||
let input = r#"
|
|
||||||
"#
|
|
||||||
.trim();
|
|
||||||
assert_eq!(part2(input)?, usize::MAX);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@ -79,25 +79,13 @@ fn part1(input: &str) -> Result<usize> {
|
|||||||
Ok(part1_apply(insts))
|
Ok(part1_apply(insts))
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[aoc(day22, part2)]
|
/*
|
||||||
|
#[aoc(day22, part2)]
|
||||||
fn part2(input: &str) -> Result<usize> {
|
fn part2(input: &str) -> Result<usize> {
|
||||||
let insts: Vec<Instruction> = input
|
todo!("part2");
|
||||||
.lines()
|
Ok(0)
|
||||||
.map(|l| l.parse().expect("failed to parse instruction"))
|
|
||||||
.collect();
|
|
||||||
dbg!(&insts);
|
|
||||||
for i in insts {
|
|
||||||
if i.x_rng.end()
|
|
||||||
- i.x_rng.start() * i.y_rng.end()
|
|
||||||
- i.y_rng.start() * i.z_rng.end()
|
|
||||||
- i.z_rng.start()
|
|
||||||
== 2758514936282235
|
|
||||||
{
|
|
||||||
println!("magic instructions {:?}", i)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Ok(0)
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
@ -143,72 +131,14 @@ on x=967..23432,y=45373..81175,z=27513..53682
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
//#[test]
|
/*
|
||||||
fn test_part2() -> Result<()> {
|
#[test]
|
||||||
|
fn test_part2()->Result<()> {
|
||||||
let input = r#"
|
let input = r#"
|
||||||
on x=-5..47,y=-31..22,z=-19..33
|
|
||||||
on x=-44..5,y=-27..21,z=-14..35
|
|
||||||
on x=-49..-1,y=-11..42,z=-10..38
|
|
||||||
on x=-20..34,y=-40..6,z=-44..1
|
|
||||||
off x=26..39,y=40..50,z=-2..11
|
|
||||||
on x=-41..5,y=-41..6,z=-36..8
|
|
||||||
off x=-43..-33,y=-45..-28,z=7..25
|
|
||||||
on x=-33..15,y=-32..19,z=-34..11
|
|
||||||
off x=35..47,y=-46..-34,z=-11..5
|
|
||||||
on x=-14..36,y=-6..44,z=-16..29
|
|
||||||
on x=-57795..-6158,y=29564..72030,z=20435..90618
|
|
||||||
on x=36731..105352,y=-21140..28532,z=16094..90401
|
|
||||||
on x=30999..107136,y=-53464..15513,z=8553..71215
|
|
||||||
on x=13528..83982,y=-99403..-27377,z=-24141..23996
|
|
||||||
on x=-72682..-12347,y=18159..111354,z=7391..80950
|
|
||||||
on x=-1060..80757,y=-65301..-20884,z=-103788..-16709
|
|
||||||
on x=-83015..-9461,y=-72160..-8347,z=-81239..-26856
|
|
||||||
on x=-52752..22273,y=-49450..9096,z=54442..119054
|
|
||||||
on x=-29982..40483,y=-108474..-28371,z=-24328..38471
|
|
||||||
on x=-4958..62750,y=40422..118853,z=-7672..65583
|
|
||||||
on x=55694..108686,y=-43367..46958,z=-26781..48729
|
|
||||||
on x=-98497..-18186,y=-63569..3412,z=1232..88485
|
|
||||||
on x=-726..56291,y=-62629..13224,z=18033..85226
|
|
||||||
on x=-110886..-34664,y=-81338..-8658,z=8914..63723
|
|
||||||
on x=-55829..24974,y=-16897..54165,z=-121762..-28058
|
|
||||||
on x=-65152..-11147,y=22489..91432,z=-58782..1780
|
|
||||||
on x=-120100..-32970,y=-46592..27473,z=-11695..61039
|
|
||||||
on x=-18631..37533,y=-124565..-50804,z=-35667..28308
|
|
||||||
on x=-57817..18248,y=49321..117703,z=5745..55881
|
|
||||||
on x=14781..98692,y=-1341..70827,z=15753..70151
|
|
||||||
on x=-34419..55919,y=-19626..40991,z=39015..114138
|
|
||||||
on x=-60785..11593,y=-56135..2999,z=-95368..-26915
|
|
||||||
on x=-32178..58085,y=17647..101866,z=-91405..-8878
|
|
||||||
on x=-53655..12091,y=50097..105568,z=-75335..-4862
|
|
||||||
on x=-111166..-40997,y=-71714..2688,z=5609..50954
|
|
||||||
on x=-16602..70118,y=-98693..-44401,z=5197..76897
|
|
||||||
on x=16383..101554,y=4615..83635,z=-44907..18747
|
|
||||||
off x=-95822..-15171,y=-19987..48940,z=10804..104439
|
|
||||||
on x=-89813..-14614,y=16069..88491,z=-3297..45228
|
|
||||||
on x=41075..99376,y=-20427..49978,z=-52012..13762
|
|
||||||
on x=-21330..50085,y=-17944..62733,z=-112280..-30197
|
|
||||||
on x=-16478..35915,y=36008..118594,z=-7885..47086
|
|
||||||
off x=-98156..-27851,y=-49952..43171,z=-99005..-8456
|
|
||||||
off x=2032..69770,y=-71013..4824,z=7471..94418
|
|
||||||
on x=43670..120875,y=-42068..12382,z=-24787..38892
|
|
||||||
off x=37514..111226,y=-45862..25743,z=-16714..54663
|
|
||||||
off x=25699..97951,y=-30668..59918,z=-15349..69697
|
|
||||||
off x=-44271..17935,y=-9516..60759,z=49131..112598
|
|
||||||
on x=-61695..-5813,y=40978..94975,z=8655..80240
|
|
||||||
off x=-101086..-9439,y=-7088..67543,z=33935..83858
|
|
||||||
off x=18020..114017,y=-48931..32606,z=21474..89843
|
|
||||||
off x=-77139..10506,y=-89994..-18797,z=-80..59318
|
|
||||||
off x=8476..79288,y=-75520..11602,z=-96624..-24783
|
|
||||||
on x=-47488..-1262,y=24338..100707,z=16292..72967
|
|
||||||
off x=-84341..13987,y=2429..92914,z=-90671..-1318
|
|
||||||
off x=-37810..49457,y=-71013..-7894,z=-105357..-13188
|
|
||||||
off x=-27365..46395,y=31009..98017,z=15428..76570
|
|
||||||
off x=-70369..-16548,y=22648..78696,z=-1892..86821
|
|
||||||
on x=-53470..21291,y=-120233..-33476,z=-44150..38147
|
|
||||||
off x=-93533..-4276,y=-16170..68771,z=-104985..-24507
|
|
||||||
"#
|
"#
|
||||||
.trim();
|
.trim();
|
||||||
assert_eq!(part2(input)?, 2758514936282235);
|
assert_eq!(part2(input)?, usize::MAX);
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,41 +0,0 @@
|
|||||||
use advent::prelude::*;
|
|
||||||
use aoc_runner_derive::aoc;
|
|
||||||
|
|
||||||
#[aoc(day23, part1)]
|
|
||||||
fn part1(input: &str) -> Result<usize> {
|
|
||||||
todo!("part1");
|
|
||||||
Ok(0)
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#[aoc(day23, part2)]
|
|
||||||
fn part2(input: &str) -> Result<usize> {
|
|
||||||
todo!("part2");
|
|
||||||
Ok(0)
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
#[cfg(test)]
|
|
||||||
mod tests {
|
|
||||||
use super::*;
|
|
||||||
|
|
||||||
#[test]
|
|
||||||
fn test_part1() -> Result<()> {
|
|
||||||
let input = r#"
|
|
||||||
"#
|
|
||||||
.trim();
|
|
||||||
assert_eq!(part1(input)?, usize::MAX);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
#[test]
|
|
||||||
fn test_part2()->Result<()> {
|
|
||||||
let input = r#"
|
|
||||||
"#
|
|
||||||
.trim();
|
|
||||||
assert_eq!(part2(input)?, usize::MAX);
|
|
||||||
Ok(())
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@ -8,12 +8,10 @@ pub mod day15;
|
|||||||
pub mod day16;
|
pub mod day16;
|
||||||
pub mod day17;
|
pub mod day17;
|
||||||
//pub mod day18;
|
//pub mod day18;
|
||||||
pub mod day19;
|
|
||||||
pub mod day2;
|
pub mod day2;
|
||||||
pub mod day20;
|
pub mod day20;
|
||||||
pub mod day21;
|
pub mod day21;
|
||||||
pub mod day22;
|
pub mod day22;
|
||||||
//pub mod day23;
|
|
||||||
pub mod day3;
|
pub mod day3;
|
||||||
pub mod day4;
|
pub mod day4;
|
||||||
pub mod day5;
|
pub mod day5;
|
||||||
|
|||||||
@ -1,2 +1 @@
|
|||||||
imports_granularity = "Crate"
|
imports_granularity = "Crate"
|
||||||
format_code_in_doc_comments = true
|
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
pub mod prelude {
|
pub mod prelude {
|
||||||
pub use std::{
|
pub use std::{
|
||||||
collections::{HashMap, HashSet, VecDeque},
|
collections::{HashMap, HashSet},
|
||||||
convert::Infallible,
|
convert::Infallible,
|
||||||
fmt::{Debug, Display, Error, Formatter},
|
fmt::{Debug, Display, Error, Formatter},
|
||||||
io::Read,
|
io::Read,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user