summaryrefslogtreecommitdiff
path: root/2024
diff options
context:
space:
mode:
authornekineki <nekineki@nekineki.net>2024-12-20 10:35:57 +0100
committernekineki <nekineki@nekineki.net>2024-12-20 10:44:58 +0100
commit0ee375cbfcdcab7bb6301acc65202317ce022373 (patch)
tree6a1d9cff773460f11e9540fe4827492decefd2be /2024
parentedc36db81e83e419c9c39cbb778f95dab1cc3a54 (diff)
day20 part1
Diffstat (limited to '2024')
-rw-r--r--2024/day20.rs111
-rw-r--r--2024/in/day20.pzl141
-rw-r--r--2024/in/day20.ref15
3 files changed, 267 insertions, 0 deletions
diff --git a/2024/day20.rs b/2024/day20.rs
new file mode 100644
index 0000000..a0549ef
--- /dev/null
+++ b/2024/day20.rs
@@ -0,0 +1,111 @@
+#![allow(dead_code)]
+#![allow(unused_variables)]
+#![allow(unused_mut)]
+use std::cmp::min;
+use std::collections::HashMap;
+use std::env;
+use std::fs::File;
+use std::io::Read;
+
+fn dfs(
+ mut score: i64,
+ sx: i64,
+ sy: i64,
+ ex: i64,
+ ey: i64,
+ m: &Vec<Vec<bool>>,
+ lut: &mut HashMap<(i64, i64), i64>,
+) -> i64 {
+ if sx == ex && sy == ey {
+ return score;
+ }
+
+ if let Some(val) = lut.get(&(sx, sy)) {
+ if *val < score {
+ return 99999999999;
+ }
+ }
+ lut.insert((sx, sy), score);
+
+ let mut s = 99999999999;
+
+ for (dx, dy) in [(1, 0), (-1, 0), (0, 1), (0, -1)] {
+ let mut x = sx + dx;
+ let mut y = sy + dy;
+ if m[y as usize][x as usize] {
+ let a = dfs(score + 1, x, y, ex, ey, &m, lut);
+ s = min(s, a);
+ }
+ }
+
+ return s;
+}
+
+fn main() {
+ let args: Vec<String> = env::args().collect();
+ let filename = if args.len() == 1 {
+ "in/".to_owned() + args[0].split('/').last().unwrap() + ".pzl"
+ } else {
+ args[1].clone()
+ };
+ let mut f = File::open(filename).expect("cannot open file");
+ let mut content = String::new();
+ f.read_to_string(&mut content).expect("cannot read file");
+ let lines = content.trim_end().split("\n");
+
+ let mut sx = 0;
+ let mut sy = 0;
+ let mut ex = 0;
+ let mut ey = 0;
+ let mut m: Vec<Vec<bool>> = Vec::new();
+ for (y, line) in lines.enumerate() {
+ let mut l: Vec<bool> = Vec::new();
+ for (x, c) in line.chars().enumerate() {
+ if c == '#' {
+ l.push(false);
+ } else {
+ l.push(true);
+ }
+ if c == 'S' {
+ sx = x as i64;
+ sy = y as i64;
+ } else if c == 'E' {
+ ex = x as i64;
+ ey = y as i64;
+ }
+ }
+ //println!("{:?}", l);
+ m.push(l);
+ }
+ let width = m.len();
+ let height = m[0].len();
+ println!("{} {}", width, height);
+
+ let mut lut: HashMap<(i64, i64), i64> = HashMap::new();
+ let ref_score = dfs(0, sx, sy, ex, ey, &m, &mut lut);
+
+ let mut res1 = 0;
+ for y in 1..height - 1 {
+ for x in 1..width - 1 {
+ if m[y][x] == true {
+ continue;
+ }
+ let mut mc = m.clone();
+ mc[y][x] = true;
+ lut.clear();
+ let score = dfs(0, sx, sy, ex, ey, &mc, &mut lut);
+ if score + 100 <= ref_score {
+ res1 += 1;
+ }
+ println!("{}", score);
+ }
+ }
+
+ //print(&m, &hs);
+ let mut res2 = 0;
+
+ println!("res1: {}", res1);
+ println!("res2: {}", res2);
+ //assert_eq!(res1, 1422);
+ //assert_eq!(res2, );
+}
diff --git a/2024/in/day20.pzl b/2024/in/day20.pzl
new file mode 100644
index 0000000..cf184da
--- /dev/null
+++ b/2024/in/day20.pzl
@@ -0,0 +1,141 @@
+#############################################################################################################################################
+#...###.....#...#...#...#...#...#...###...#.....#.........#...#.......#...#.....#...#.........###...#.....#.............#...#...#.......#...#
+#.#.###.###.#.#.#.#.#.#.#.#.#.#.#.#.###.#.#.###.#.#######.#.#.#.#####.#.#.#.###.#.#.#.#######.###.#.#.###.#.###########.#.#.#.#.#.#####.#.#.#
+#.#.#...#...#.#...#...#...#...#...#...#.#...#...#.#.......#.#.#.#.....#.#.#...#...#.#.#.......#...#...#...#.#.....#.....#.#.#.#.#.#.....#.#.#
+#.#.#.###.###.#######################.#.#####.###.#.#######.#.#.#.#####.#.###.#####.#.#.#######.#######.###.#.###.#.#####.#.#.#.#.#.#####.#.#
+#.#.#...#.###.....#.............#...#.#.#...#.#...#.#...###.#...#.......#.#...#...#.#.#.###.....#.....#.....#.###...#.....#.#.#...#.......#.#
+#.#.###.#.#######.#.###########.#.#.#.#.#.#.#.#.###.#.#.###.#############.#.###.#.#.#.#.###.#####.###.#######.#######.#####.#.#############.#
+#.#.....#.#...#...#...#.....###...#.#.#.#.#...#...#...#...#.#...#.........#.....#.#...#...#.......#...#...#...#...###.....#.#.#.............#
+#.#######.#.#.#.#####.#.###.#######.#.#.#.#######.#######.#.#.#.#.###############.#######.#########.###.#.#.###.#.#######.#.#.#.#############
+#.......#.#.#.#.......#...#...#.....#.#.#.#...###.#.......#...#.#.#.......#...#...#.......#.....###.#...#...###.#...#.....#...#...#.........#
+#######.#.#.#.###########.###.#.#####.#.#.#.#.###.#.###########.#.#.#####.#.#.#.###.#######.###.###.#.#########.###.#.###########.#.#######.#
+#...#...#.#.#.#...###...#...#.#.....#.#.#...#.#...#.#...###.....#...#.....#.#.#.#...###...#...#.#...#.#...#...#...#...#...........#.#.......#
+#.#.#.###.#.#.#.#.###.#.###.#.#####.#.#.#####.#.###.#.#.###.#########.#####.#.#.#.#####.#.###.#.#.###.#.#.#.#.###.#####.###########.#.#######
+#.#.#...#.#.#.#.#...#.#...#.#.#...#.#.#.#.....#.#...#.#...#.....#.....###...#...#.#...#.#.#...#.#...#.#.#...#...#...#...#...#.....#.#.......#
+#.#.###.#.#.#.#.###.#.###.#.#.#.#.#.#.#.#.#####.#.###.###.#####.#.#######.#######.#.#.#.#.#.###.###.#.#.#######.###.#.###.#.#.###.#.#######.#
+#.#.....#.#.#.#.#...#...#...#...#...#...#.......#.....#...#...#.#.......#.....#...#.#.#.#.#...#.###.#.#.....#...#...#.....#...#...#.#.......#
+#.#######.#.#.#.#.#####.###############################.###.#.#.#######.#####.#.###.#.#.#.###.#.###.#.#####.#.###.#############.###.#.#######
+#.......#...#.#.#...###...#...#.....#...#.............#.#...#.#.#.......#.....#.....#.#.#.#...#...#.#.###...#.###.#.............#...#.......#
+#######.#####.#.###.#####.#.#.#.###.#.#.#.###########.#.#.###.#.#.#######.###########.#.#.#.#####.#.#.###.###.###.#.#############.#########.#
+#.....#.....#.#.#...#...#...#.#.#...#.#.#.#.....#...#...#...#...#.....#...#...........#.#.#.....#...#.#...#...#...#.......###...#.#.........#
+#.###.#####.#.#.#.###.#.#####.#.#.###.#.#.#.###.#.#.#######.#########.#.###.###########.#.#####.#####.#.###.###.#########.###.#.#.#.#########
+#...#.......#...#...#.#.#...#...#.....#.#.#.#...#.#...###...#.........#...#...#.....#...#.#.....#...#.#...#.#...#...#.....#...#.#.#.#.......#
+###.###############.#.#.#.#.###########.#.#.#.###.###.###.###.###########.###.#.###.#.###.#.#####.#.#.###.#.#.###.#.#.#####.###.#.#.#.#####.#
+###.#.....#.......#...#.#.#.....#.......#...#.....#...#...#...#.....#...#.#...#...#.#.#...#...#...#...#...#...#...#.#...###...#...#...#...#.#
+###.#.###.#.#####.#####.#.#####.#.#################.###.###.###.###.#.#.#.#.#####.#.#.#.#####.#.#######.#######.###.###.#####.#########.#.#.#
+#...#.###...###...#...#...#.....#.........#...#.....###...#...#.#...#.#.#.#.###...#.#.#...#...#.#...###.....#...###...#...###.#.....#...#.#.#
+#.###.#########.###.#.#####.#############.#.#.#.#########.###.#.#.###.#.#.#.###.###.#.###.#.###.#.#.#######.#.#######.###.###.#.###.#.###.#.#
+#...#.#...#.....#...#.....#.#...###.......#.#...###...#...#...#.#.#...#.#.#...#...#.#.#...#.#...#.#...#...#.#.....###...#.....#...#...###...#
+###.#.#.#.#.#####.#######.#.#.#.###.#######.#######.#.#.###.###.#.#.###.#.###.###.#.#.#.###.#.###.###.#.#.#.#####.#####.#########.###########
+###...#.#.#...#...#.......#...#...#.......#...#...#.#...#...###.#.#...#.#...#.#...#.#.#...#.#.###.#...#.#.#.#.....#...#.#...#...#...#...#...#
+#######.#.###.#.###.#############.#######.###.#.#.#.#####.#####.#.###.#.###.#.#.###.#.###.#.#.###.#.###.#.#.#.#####.#.#.#.#.#.#.###.#.#.#.#.#
+#.......#.....#...#.........#...#.#...#...#...#.#.#.....#.#...#.#.#...#.#...#.#.#...#.#...#.#...#.#...#.#.#.#.....#.#.#...#...#.....#.#...#.#
+#.###############.#########.#.#.#.#.#.#.###.###.#.#####.#.#.#.#.#.#.###.#.###.#.#.###.#.###.###.#.###.#.#.#.#####.#.#.###############.#####.#
+#.......#...#.....#...#...#...#.#...#.#.#...###.#.#...#.#.#.#.#.#.#...#.#.#...#.#.###.#.###.#...#...#.#.#...#...#...#...###...#...#...#...#.#
+#######.#.#.#.#####.#.#.#.#####.#####.#.#.#####.#.#.#.#.#.#.#.#.#.###.#.#.#.###.#.###.#.###.#.#####.#.#.#####.#.#######.###.#.#.#.#.###.#.#.#
+#...###...#...#.....#...#.....#.....#...#.#...#.#.#.#...#...#.#.#...#.#.#.#.#...#...#.#...#.#...#...#.#.#.....#.........#...#...#...#...#...#
+#.#.###########.#############.#####.#####.#.#.#.#.#.#########.#.###.#.#.#.#.#.#####.#.###.#.###.#.###.#.#.###############.###########.#######
+#.#.#...###...#.............#.#...#.....#...#.#.#.#...#.......#...#...#.#.#.#.#.....#...#.#.#...#...#.#.#.............###.#.......#...#...###
+#.#.#.#.###.#.#############.#.#.#.#####.#####.#.#.###.#.#########.#####.#.#.#.#.#######.#.#.#.#####.#.#.#############.###.#.#####.#.###.#.###
+#.#...#.....#.#...#...#.....#...#.......#.....#.#.#...#.....#...#...#...#.#.#.#.#...#...#...#.#...#.#.#.#.......#...#.....#.....#.#.....#...#
+#.###########.#.#.#.#.#.#################.#####.#.#.#######.#.#.###.#.###.#.#.#.#.#.#.#######.#.#.#.#.#.#.#####.#.#.###########.#.#########.#
+#.#.....#...#...#...#...#...#...#...#...#.....#.#.#.......#...#.#...#...#.#...#...#.#.....#...#.#...#...#.....#...#...#...#.....#...........#
+#.#.###.#.#.#############.#.#.#.#.#.#.#.#####.#.#.#######.#####.#.#####.#.#########.#####.#.###.#############.#######.#.#.#.#################
+#.#.#...#.#.........#...#.#.#.#.#.#...#.....#...#.#.....#.#.....#...###.#.#.........#...#.#.....#...........#.......#.#.#.#...#...#...#...###
+#.#.#.###.#########.#.#.#.#.#.#.#.#########.#####.#.###.#.#.#######.###.#.#.#########.#.#.#######.#########.#######.#.#.#.###.#.#.#.#.#.#.###
+#.#.#.....#.......#.#.#...#.#.#.#.#.......#.#.....#.###.#.#...#...#...#...#.....#...#.#...###...#.........#.#...#...#...#...#...#...#.#.#...#
+#.#.#######.#####.#.#.#####.#.#.#.#.#####.#.#.#####.###.#.###.#.#.###.#########.#.#.#.#######.#.#########.#.#.#.#.#########.#########.#.###.#
+#...###...#.....#.#...#.....#.#...#.....#.#.#.....#...#.#...#...#...#...#.......#.#.#...###...#...........#...#...#...#####...........#...#.#
+#######.#.#####.#.#####.#####.#########.#.#.#####.###.#.###.#######.###.#.#######.#.###.###.#######################.#.###################.#.#
+#...#...#.#.....#.#...#.......#.........#...###...#...#.#...#.......#...#.#.....#.#...#...#.#...#...#.....#...#...#.#...###...#...#...#...#.#
+#.#.#.###.#.#####.#.#.#########.###############.###.###.#.###.#######.###.#.###.#.###.###.#.#.#.#.#.#.###.#.#.#.#.#.###.###.#.#.#.#.#.#.###.#
+#.#.#...#.#.....#.#.#.#...###...#.............#.#...###.#.#...#...#...###.#.#...#...#.#...#...#...#.#.#...#.#.#.#...#...#...#...#...#...#...#
+#.#.###.#.#####.#.#.#.#.#.###.###.###########.#.#.#####.#.#.###.#.#.#####.#.#.#####.#.#.###########.#.#.###.#.#.#####.###.###############.###
+#.#.....#.......#...#...#...#...#.#...#.......#...#...#...#...#.#.#.....#...#.#...#.#.#.#...........#.#.....#...#.....#...#...#.....#...#...#
+#.#########################.###.#.#.#.#.###########.#.#######.#.#.#####.#####.#.#.#.#.#.#.###########.###########.#####.###.#.#.###.#.#.###.#
+#.....#...#.............#...###...#.#...#...#####...#.......#...#.#.....###...#.#.#.#...#...........#.###.....#...###...#...#...###...#.....#
+#####.#.#.#.###########.#.#########.#####.#.#####.#########.#####.#.#######.###.#.#.###############.#.###.###.#.#####.###.###################
+#...#...#.#.#...........#...#.......#...#.#...#...#.........###...#.......#...#.#.#.#.............#.#.#...#...#.......#...#...#...#.........#
+#.#.#####.#.#.#############.#.#######.#.#.###.#.###.###########.#########.###.#.#.#.#.###########.#.#.#.###.###########.###.#.#.#.#.#######.#
+#.#.....#...#.............#.#...#.....#...#...#...#.#...###...#...#.......###.#.#...#...........#.#...#...#...........#...#.#.#.#.#.....#...#
+#.#####.#################.#.###.#.#########.#####.#.#.#.###.#.###.#.#########.#.###############.#.#######.###########.###.#.#.#.#.#####.#.###
+#.#...#...###...#.........#...#...#...#...#.......#...#.#...#...#.#.....#.....#.....#.....#.....#.#...###...........#.....#.#...#.###...#...#
+#.#.#.###.###.#.#.###########.#####.#.#.#.#############.#.#####.#.#####.#.#########.#.###.#.#####.#.#.#############.#######.#####.###.#####.#
+#.#.#...#.....#...#.....#...#...#...#...#.#...#...#...#...#...#.#.#.....#.......#...#...#.#.....#.#.#...............#.......#.....#...#.....#
+#.#.###.###########.###.#.#.###.#.#######.#.#.#.#.#.#.#####.#.#.#.#.###########.#.#####.#.#####.#.#.#################.#######.#####.###.#####
+#.#.###.....#...#...###...#...#.#...#...#...#...#...#.#.....#.#.#.#.....#.......#.#.....#.#.....#...#...............#...#.....#...#...#.#...#
+#.#.#######.#.#.#.###########.#.###.#.#.#############.#.#####.#.#.#####.#.#######.#.#####.#.#########.#############.###.#.#####.#.###.#.#.#.#
+#.#.#.......#.#.#.#.......###.#.###...#.#...#.......#.#.....#...#.#...#.#...#...#.#.....#.#...........#.........#...###.#.......#.....#...#.#
+#.#.#.#######.#.#.#.#####.###.#.#######.#.#.#.#####.#.#####.#####.#.#.#.###.#.#.#.#####.#.#############.#######.#.#####.###################.#
+#...#.#...#...#...#.....#.....#.......#...#...#...#.#...#...#.....#.#.#.###.#.#...#.....#.....#.......#.......#.#.#.....#.........#...#...#.#
+#####.#.#.#.###########.#############.#########.#.#.###.#.###.#####.#.#.###.#.#####.#########.#.#####.#######.#.#.#.#####.#######.#.#.#.#.#.#
+#...#...#...#.......###...#.........#.#.....#...#...#...#...#.......#.#.#...#...###...#.....#...#...#.........#...#.#.....#.....#.#.#.#.#...#
+#.#.#########.#####.#####.#.#######.#.#.###.#.#######.#####.#########.#.#.#####.#####.#.###.#####.#.###############.#.#####.###.#.#.#.#.#####
+#.#...........#...#.......#...#.....#...###.#.....###.......#...#.....#.#...#...#.....#.###.......#.......#...#...#.#.......#...#...#...#...#
+#.#############.#.###########.#.###########.#####.###########.#.#.#####.###.#.###.#####.#################.#.#.#.#.#.#########.###########.#.#
+#.#.............#.........#...#...........#.#...#.............#.#.#.....###.#...#.#.....#...........#...#...#.#.#.#.#.....#...#...........#.#
+#.#.#####################.#.#############.#.#.#.###############.#.#.#######.###.#.#.#####.#########.#.#.#####.#.#.#.#.###.#.###.###########.#
+#...#...#.................#.###...#...#...#...#.#.......#.......#...#.......#...#...#.....#.......#...#.......#.#...#...#...###.#.......#...#
+#####.#.#.#################.###.#.#.#.#.#######.#.#####.#.###########.#######.#######.#####.#####.#############.#######.#######.#.#####.#.###
+#.....#...#...#.....#.....#.#...#...#...#...###.#.....#.#.....###...#.........#.......#...#.#...#.....#...#.....#.....#.........#.....#...###
+#.#########.#.#.###.#.###.#.#.###########.#.###.#####.#.#####.###.#.###########.#######.#.#.#.#.#####.#.#.#.#####.###.###############.#######
+#.#.....#...#...###...###...#.............#...#...#...#.......#...#...#...#...#.........#...#.#.#...#...#...#.....###.#.......#.......#...###
+#.#.###.#.###################################.###.#.###########.#####.#.#.#.#.###############.#.#.#.#########.#######.#.#####.#.#######.#.###
+#...###...#.......###...#...#.........#.......###...###...###...#.....#.#.#.#.#############...#...#.#...#...#.......#.#.....#...#.......#...#
+###########.#####.###.#.#.#.#.#######.#.###############.#.###.###.#####.#.#.#.#############.#######.#.#.#.#.#######.#.#####.#####.#########.#
+#...........#...#.#...#...#...#.....#.#...#...#...#...#.#.#...#...#...#.#.#.#S#############.......#...#...#...#...#.#.#...#...###.#.........#
+#.###########.#.#.#.###########.###.#.###.#.#.#.#.#.#.#.#.#.###.###.#.#.#.#.#####################.###########.#.#.#.#.#.#.###.###.#.#########
+#.....#.......#.#...#...#.......#...#.#...#.#.#.#...#.#.#.#...#.#...#.#.#.#.........#########...#.#.........#...#...#...#...#.....#.........#
+#####.#.#######.#####.#.#.#######.###.#.###.#.#.#####.#.#.###.#.#.###.#.#.#########.#########.#.#.#.#######.###############.###############.#
+#.....#.#.......#.....#...#...###...#...###.#.#.....#...#...#.#.#.#...#.#.#...#...#.#########.#...#.#.......#.............#...#.............#
+#.#####.#.#######.#########.#.#####.#######.#.#####.#######.#.#.#.#.###.#.#.#.#.#.#.#########.#####.#.#######.###########.###.#.#############
+#.#...#.#.........#.........#.......#.......#.....#...#.....#.#...#.....#.#.#.#.#.#.#########.....#.#.....#...#.......#...###.#.........#...#
+#.#.#.#.###########.#################.###########.###.#.#####.###########.#.#.#.#.#.#############.#.#####.#.###.#####.#.#####.#########.#.#.#
+#...#...#...........#...#...#.........#...........###.#.....#.........#...#.#.#.#...#############...#...#...#...#...#.#.#...#.#...#.....#.#.#
+#########.###########.#.#.#.#.#########.#############.#####.#########.#.###.#.#.#####################.#.#####.###.#.#.#.#.#.#.#.#.#.#####.#.#
+#.......#...#...#.....#...#.#.#.......#...........#...#.....#...#...#.#.#...#.#.....#####......E#.....#.......###.#.#...#.#.#.#.#.#.......#.#
+#.#####.###.#.#.#.#########.#.#.#####.###########.#.###.#####.#.#.#.#.#.#.###.#####.#####.#######.###############.#.#####.#.#.#.#.#########.#
+#.....#.###...#...#...###...#.#.#...#...#...#...#.#...#.#...#.#...#...#.#...#.#...#.#.....#.....#.................#.....#.#.#.#.#.#.....#...#
+#####.#.###########.#.###.###.#.#.#.###.#.#.#.#.#.###.#.#.#.#.#########.###.#.#.#.#.#.#####.###.#######################.#.#.#.#.#.#.###.#.###
+###...#...#.........#.....#...#...#...#...#...#...#...#...#.#.....#.....#...#.#.#...#.......#...#...#...#...#.....#.....#.#.#...#.#.#...#.###
+###.#####.#.###############.#########.#############.#######.#####.#.#####.###.#.#############.###.#.#.#.#.#.#.###.#.#####.#.#####.#.#.###.###
+#...#.....#.......#.........#.........#.....#.....#.....#...###...#.#...#...#.#.#.............#...#.#.#.#.#...###...#.....#.#...#...#...#...#
+#.###.###########.#.#########.#########.###.#.###.#####.#.#####.###.#.#.###.#.#.#.#############.###.#.#.#.###########.#####.#.#.#######.###.#
+#...#...#.........#.###...###.......###.#...#.#...#...#.#.#...#.#...#.#.###.#.#.#.###...###...#.#...#.#.#...#...#...#.#.....#.#.#.....#.#...#
+###.###.#.#########.###.#.#########.###.#.###.#.###.#.#.#.#.#.#.#.###.#.###.#.#.#.###.#.###.#.#.#.###.#.###.#.#.#.#.#.#.#####.#.#.###.#.#.###
+###...#.#.........#.#...#...#.......#...#.#...#.#...#...#.#.#.#.#...#.#.....#.#.#.....#.#...#.#.#.#...#...#...#...#...#.......#...#...#.#...#
+#####.#.#########.#.#.#####.#.#######.###.#.###.#.#######.#.#.#.###.#.#######.#.#######.#.###.#.#.#.#####.#########################.###.###.#
+#.....#.........#...#.....#...#...#...#...#.#...#...#.....#.#.#...#...###.....#.....#...#.###...#.#.###...#...#...#...#.............###...#.#
+#.#############.#########.#####.#.#.###.###.#.#####.#.#####.#.###.#######.#########.#.###.#######.#.###.###.#.#.#.#.#.#.#################.#.#
+#.....#...#...#.......###.#.....#.#.###...#.#...#...#.....#.#.#...#.......#...#...#.#...#.....###.#.#...#...#...#.#.#.#.............#.....#.#
+#####.#.#.#.#.#######.###.#.#####.#.#####.#.###.#.#######.#.#.#.###.#######.#.#.#.#.###.#####.###.#.#.###.#######.#.#.#############.#.#####.#
+#.....#.#...#.......#.....#.#.....#...###...#...#.......#...#.#.###.#.....#.#.#.#.#.#...#...#...#...#...#.###...#.#.#.#...#...#.....#.#...#.#
+#.#####.###########.#######.#.#######.#######.#########.#####.#.###.#.###.#.#.#.#.#.#.###.#.###.#######.#.###.#.#.#.#.#.#.#.#.#.#####.#.#.#.#
+#.....#.#...........#...#...#.....#...#.......#...#.....#.....#...#...#...#.#.#.#.#.#.#...#.#...#.......#.....#.#...#...#...#.#.....#...#.#.#
+#####.#.#.###########.#.#.#######.#.###.#######.#.#.#####.#######.#####.###.#.#.#.#.#.#.###.#.###.#############.#############.#####.#####.#.#
+#.....#.#...........#.#.#...###...#...#...#...#.#.#.....#...#...#.###...#...#.#.#.#.#.#.#...#.#...#.....#.....#.............#.#...#.....#.#.#
+#.#####.###########.#.#.###.###.#####.###.#.#.#.#.#####.###.#.#.#.###.###.###.#.#.#.#.#.#.###.#.###.###.#.###.#############.#.#.#.#####.#.#.#
+#...#...#...........#.#...#.#...#...#...#...#...#.#.....###.#.#.#.#...#...###.#.#...#...#...#.#.#...###.#...#.#...#.....#...#...#.......#...#
+###.#.###.###########.###.#.#.###.#.###.#########.#.#######.#.#.#.#.###.#####.#.###########.#.#.#.#####.###.#.#.#.#.###.#.###################
+###.#...#...........#.#...#.#...#.#...#.#.........#.###.....#.#.#.#...#.....#.#...#.......#.#.#.#...#...#...#.#.#.#...#.#...###.............#
+###.###.###########.#.#.###.###.#.###.#.#.#########.###.#####.#.#.###.#####.#.###.#.#####.#.#.#.###.#.###.###.#.#.###.#.###.###.###########.#
+#...#...###.........#.#.....#...#...#...#.........#...#.#.....#.#.###...#...#.....#.....#...#.#.#...#...#...#.#.#.#...#...#.....#...#...#...#
+#.###.#####.#########.#######.#####.#############.###.#.#.#####.#.#####.#.#############.#####.#.#.#####.###.#.#.#.#.#####.#######.#.#.#.#.###
+#.....#.....#.....#...#.......#.....#...#.........#...#.#...###.#.#.....#.#...###.......#...#.#.#.#.....#...#...#.#.....#.#.......#.#.#.#...#
+#######.#####.###.#.###.#######.#####.#.#.#########.###.###.###.#.#.#####.#.#.###.#######.#.#.#.#.#.#####.#######.#####.#.#.#######.#.#.###.#
+#.......#...#.#...#.###...#...#.....#.#.#.......#...###...#.#...#.#.....#...#...#...#...#.#.#.#.#.#.....#.....#...#.....#.#.......#...#...#.#
+#.#######.#.#.#.###.#####.#.#.#####.#.#.#######.#.#######.#.#.###.#####.#######.###.#.#.#.#.#.#.#.#####.#####.#.###.#####.#######.#######.#.#
+#...#...#.#.#.#...#...#...#.#.....#...#.#.......#.....#...#.#.#...#.....#.......###.#.#.#.#...#.#.#...#.#.....#...#.....#...#.....#.....#.#.#
+###.#.#.#.#.#.###.###.#.###.#####.#####.#.###########.#.###.#.#.###.#####.#########.#.#.#.#####.#.#.#.#.#.#######.#####.###.#.#####.###.#.#.#
+#...#.#.#.#.#.#...#...#.....#.....#.....#.#.....#.....#.#...#.#...#.#...#.......#...#.#.#.....#.#.#.#...#...#...#.#.....#...#.......#...#...#
+#.###.#.#.#.#.#.###.#########.#####.#####.#.###.#.#####.#.###.###.#.#.#.#######.#.###.#.#####.#.#.#.#######.#.#.#.#.#####.###########.#######
+#...#.#.#.#.#.#...#.#.......#.....#.....#.#.#...#.....#.#.###...#.#.#.#.#.....#.#.#...#...#...#.#.#...#.....#.#...#.....#.#...#.......#...###
+###.#.#.#.#.#.###.#.#.#####.#####.#####.#.#.#.#######.#.#.#####.#.#.#.#.#.###.#.#.#.#####.#.###.#.###.#.#####.#########.#.#.#.#.#######.#.###
+#...#.#.#.#.#.#...#.#.#...#.......#...#.#.#.#...#...#.#.#.#...#...#...#.#.###.#.#.#.....#.#.#...#...#.#.....#.#...#...#.#.#.#.#...#.....#...#
+#.###.#.#.#.#.#.###.#.#.#.#########.#.#.#.#.###.#.#.#.#.#.#.#.#########.#.###.#.#.#####.#.#.#.#####.#.#####.#.#.#.#.#.#.#.#.#.###.#.#######.#
+#.#...#...#.#.#.#...#...#...#...#...#.#.#.#...#.#.#.#.#.#...#...#.......#...#.#.#...#...#.#.#.#.....#.#.....#.#.#...#.#.#.#.#...#...#...#...#
+#.#.#######.#.#.#.#########.#.#.#.###.#.#.###.#.#.#.#.#.#######.#.#########.#.#.###.#.###.#.#.#.#####.#.#####.#.#####.#.#.#.###.#####.#.#.###
+#.#...#.....#.#.#.#.........#.#.#...#.#.#.#...#.#.#.#.#.#...#...#...#...#...#.#.#...#.#...#.#.#.#.....#.....#.#.....#.#.#.#...#...#...#.#...#
+#.###.#.#####.#.#.#.#########.#.###.#.#.#.#.###.#.#.#.#.#.#.#.#####.#.#.#.###.#.#.###.#.###.#.#.#.#########.#.#####.#.#.#.###.###.#.###.###.#
+#.....#.......#...#...........#.....#...#...###...#...#...#...#####...#...###...#.....#.....#...#...........#.......#...#.....###...###.....#
+#############################################################################################################################################
diff --git a/2024/in/day20.ref b/2024/in/day20.ref
new file mode 100644
index 0000000..c097dae
--- /dev/null
+++ b/2024/in/day20.ref
@@ -0,0 +1,15 @@
+###############
+#...#...#.....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..E#...#...#
+###.#######.###
+#...###...#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############