Compare commits

...

6 Commits

Author SHA1 Message Date
afff8dd79f Final 2021 changes. 2022-11-30 18:56:34 -08:00
6cab94ba0b Day 22 part 2 stubbed out 2021-12-23 20:46:56 -08:00
987760422a Day 22 part 1 2021-12-23 20:34:13 -08:00
2400d34336 Day 21 some clippy cleanup 2021-12-23 19:44:52 -08:00
e4e00517f7 Disable broken day 21 part 2. 2021-12-23 19:43:32 -08:00
d56885bd14 Day 21 part 1 and non-functioning part 2. 2021-12-23 19:25:22 -08:00
11 changed files with 1964 additions and 3 deletions

1054
2021/input/2021/day19.txt Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,2 @@
Player 1 starting position: 4
Player 2 starting position: 5

View File

@@ -0,0 +1,5 @@
#############
#...........#
###D#A#C#D###
#C#A#B#B#
#########

469
2021/src/day19.rs Normal file
View File

@@ -0,0 +1,469 @@
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(&reg, &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 = &registered[i];
let s2 = &registered[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(())
}
*/
}

171
2021/src/day21.rs Normal file
View File

@@ -0,0 +1,171 @@
use advent::prelude::*;
use aoc_runner_derive::aoc;
#[derive(Copy, Clone, Debug)]
struct Player {
tally: usize,
score: usize,
}
impl Player {
fn space(&self) -> usize {
(self.tally % 10) + 1
}
}
#[derive(Debug, Default)]
struct Die {
roll_count: usize,
}
impl Die {
fn roll(&mut self) -> usize {
let val = (self.roll_count % 100) + 1;
self.roll_count += 1;
val
}
}
fn take_turn(p: &mut Player, die: &mut Die) -> bool {
p.tally += die.roll() + die.roll() + die.roll();
p.score += p.space();
if p.score >= 1000 {
return true;
}
false
}
#[aoc(day21, part1)]
fn part1(input: &str) -> Result<usize> {
let mut p: Vec<_> = input
.lines()
.map(|l| l.split_once(": ").unwrap())
.map(|(_, space)| space.parse().expect("couldn't parse starting spaceition"))
.map(|space: usize| Player {
tally: space - 1,
score: 0,
})
.collect();
let mut die = Die::default();
loop {
if take_turn(&mut p[0], &mut die) {
return Ok(die.roll_count * p[1].score);
}
//println!( "Player 1 space {} for a total score of {}.", p[0].space(), p[0].score);
if take_turn(&mut p[1], &mut die) {
return Ok(die.roll_count * p[0].score);
}
//println!( "Player 2 space {} for a total score of {}.", p[1].space(), p[1].score);
}
}
fn play_part2(p1: Player, p2: Player) -> (usize, usize) {
fn play_part2_rec(
mut p1: Player,
mut p2: Player,
r1: usize,
r2: usize,
r3: usize,
r4: usize,
r5: usize,
r6: usize,
) -> (usize, usize) {
//println!( "p1 {} {} p2 {} {} die {} {} {} {} {} {}", p1.score, p1.space(), p2.score, p2.space(), r1, r2, r3, r4, r5, r6,);
p1.tally += r1 + r2 + r3;
p1.score += p1.space();
if p1.score >= 21 {
return (1, 0);
}
p2.tally += r4 + r5 + r6;
p2.score += p2.space();
if p2.score >= 21 {
return (0, 1);
}
let mut p1_score = 0;
let mut p2_score = 0;
for i in [1, 2, 3] {
for j in [1, 2, 3] {
for k in [1, 2, 3] {
for x in [1, 2, 3] {
for y in [1, 2, 3] {
for z in [1, 2, 3] {
let (p1s, p2s) = play_part2_rec(p1, p2, i, j, k, x, y, z);
p1_score += p1s;
p2_score += p2s;
}
}
}
}
}
}
(p1_score, p2_score)
}
let mut p1_score = 0;
let mut p2_score = 0;
for i in [1, 2, 3] {
for j in [1, 2, 3] {
for k in [1, 2, 3] {
for x in [1, 2, 3] {
for y in [1, 2, 3] {
for z in [1, 2, 3] {
let (p1s, p2s) = play_part2_rec(p1, p2, i, j, k, x, y, z);
p1_score += p1s;
p2_score += p2s;
println!("Running score {} vs {}", p1_score, p2_score);
}
}
}
}
}
}
(p1_score, p2_score)
}
//#[aoc(day21, part2)]
fn part2(input: &str) -> Result<usize> {
let p: Vec<_> = input
.lines()
.map(|l| l.split_once(": ").unwrap())
.map(|(_, space)| space.parse().expect("couldn't parse starting spaceition"))
.map(|space: usize| Player {
tally: space - 1,
score: 0,
})
.collect();
let (p1_wins, p2_wins) = play_part2(p[0], p[1]);
Ok(if p1_wins > p2_wins { p1_wins } else { p2_wins })
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_part1() -> Result<()> {
let input = r#"
Player 1 starting position: 4
Player 2 starting position: 8
"#
.trim();
assert_eq!(part1(input)?, 739785);
Ok(())
}
//#[test]
fn test_part2() -> Result<()> {
let input = r#"
Player 1 starting position: 4
Player 2 starting position: 8
"#
.trim();
assert_eq!(part2(input)?, 444356092776315);
Ok(())
}
}

214
2021/src/day22.rs Normal file
View File

@@ -0,0 +1,214 @@
use advent::prelude::*;
use aoc_runner_derive::aoc;
#[derive(Debug)]
struct Instruction {
on: bool,
x_rng: RangeInclusive<i64>,
y_rng: RangeInclusive<i64>,
z_rng: RangeInclusive<i64>,
}
impl FromStr for Instruction {
type Err = Infallible;
fn from_str(input: &str) -> std::result::Result<Instruction, Infallible> {
// on x=11..13,y=11..13,z=11..13
// off x=9..11,y=9..11,z=9..11
let (verb, rest) = input.split_once(' ').unwrap();
let on = match verb {
"on" => true,
"off" => false,
_ => unreachable!("unexpected instruction type"),
};
let parts: Vec<_> = rest.split(',').collect();
let parse_rng = |s: &str| -> RangeInclusive<i64> {
s.split_once('=')
.unwrap()
.1
.split_once("..")
.map(|(lo, hi)| (lo.parse().unwrap(), hi.parse().unwrap()))
.map(|(lo, hi)| lo..=hi)
.unwrap()
};
let x_rng = parse_rng(parts[0]);
let y_rng = parse_rng(parts[1]);
let z_rng = parse_rng(parts[2]);
Ok(Instruction {
on,
x_rng,
y_rng,
z_rng,
})
}
}
fn part1_apply(insts: Vec<Instruction>) -> usize {
let mut grid = HashSet::new();
for inst in &insts {
dbg!(&inst);
for x in inst.x_rng.clone() {
for y in inst.y_rng.clone() {
for z in inst.z_rng.clone() {
if inst.on {
grid.insert((x, y, z));
} else {
grid.remove(&(x, y, z));
}
}
}
}
}
grid.len()
}
fn inbounds(r: &RangeInclusive<i64>) -> bool {
// lazy but good enough for part1
r.start().abs() <= 50
}
#[aoc(day22, part1)]
fn part1(input: &str) -> Result<usize> {
let insts: Vec<Instruction> = input
.lines()
.map(|l| l.parse().expect("failed to parse instruction"))
.filter(|i: &Instruction| inbounds(&i.x_rng) && inbounds(&i.y_rng) && inbounds(&i.z_rng))
.collect();
dbg!(&insts);
Ok(part1_apply(insts))
}
//#[aoc(day22, part2)]
fn part2(input: &str) -> Result<usize> {
let insts: Vec<Instruction> = input
.lines()
.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)]
mod tests {
use super::*;
#[test]
fn test_part1() -> Result<()> {
let input = r#"
on x=10..12,y=10..12,z=10..12
on x=11..13,y=11..13,z=11..13
off x=9..11,y=9..11,z=9..11
on x=10..10,y=10..10,z=10..10
"#
.trim();
assert_eq!(part1(input)?, 39);
let input = r#"
on x=-20..26,y=-36..17,z=-47..7
on x=-20..33,y=-21..23,z=-26..28
on x=-22..28,y=-29..23,z=-38..16
on x=-46..7,y=-6..46,z=-50..-1
on x=-49..1,y=-3..46,z=-24..28
on x=2..47,y=-22..22,z=-23..27
on x=-27..23,y=-28..26,z=-21..29
on x=-39..5,y=-6..47,z=-3..44
on x=-30..21,y=-8..43,z=-13..34
on x=-22..26,y=-27..20,z=-29..19
off x=-48..-32,y=26..41,z=-47..-37
on x=-12..35,y=6..50,z=-50..-2
off x=-48..-32,y=-32..-16,z=-15..-5
on x=-18..26,y=-33..15,z=-7..46
off x=-40..-22,y=-38..-28,z=23..41
on x=-16..35,y=-41..10,z=-47..6
off x=-32..-23,y=11..30,z=-14..3
on x=-49..-5,y=-3..45,z=-29..18
off x=18..30,y=-20..-8,z=-3..13
on x=-41..9,y=-7..43,z=-33..15
on x=-54112..-39298,y=-85059..-49293,z=-27449..7877
on x=967..23432,y=45373..81175,z=27513..53682
"#
.trim();
assert_eq!(part1(input)?, 590784);
Ok(())
}
//#[test]
fn test_part2() -> Result<()> {
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();
assert_eq!(part2(input)?, 2758514936282235);
Ok(())
}
}

41
2021/src/day23.rs Normal file
View File

@@ -0,0 +1,41 @@
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(())
}
*/
}

View File

@@ -8,8 +8,12 @@ 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 day22;
//pub mod day23;
pub mod day3; pub mod day3;
pub mod day4; pub mod day4;
pub mod day5; pub mod day5;

View File

@@ -1,5 +1,5 @@
use advent::prelude::*; use advent::prelude::*;
use aoc_runner_derive::{aoc, aoc_generator}; use aoc_runner_derive::aoc;
#[aoc(dayX, part1)] #[aoc(dayX, part1)]
fn part1(input: &str) -> Result<usize> { fn part1(input: &str) -> Result<usize> {

View File

@@ -1 +1,2 @@
imports_granularity = "Crate" imports_granularity = "Crate"
format_code_in_doc_comments = true

View File

@@ -1,11 +1,11 @@
pub mod prelude { pub mod prelude {
pub use std::{ pub use std::{
collections::{HashMap, HashSet}, collections::{HashMap, HashSet, VecDeque},
convert::Infallible, convert::Infallible,
fmt::{Debug, Display, Error, Formatter}, fmt::{Debug, Display, Error, Formatter},
io::Read, io::Read,
num::ParseIntError, num::ParseIntError,
ops::{Index, IndexMut}, ops::{Index, IndexMut, RangeInclusive},
str::FromStr, str::FromStr,
}; };