Initial commit
This commit is contained in:
commit
c65881bfd0
7 changed files with 1311 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/target
|
7
Cargo.lock
generated
Normal file
7
Cargo.lock
generated
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# This file is automatically @generated by Cargo.
|
||||||
|
# It is not intended for manual editing.
|
||||||
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "advent_of_code_2023"
|
||||||
|
version = "0.1.0"
|
8
Cargo.toml
Normal file
8
Cargo.toml
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
[package]
|
||||||
|
name = "advent_of_code_2023"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
1000
input/1.txt
Normal file
1000
input/1.txt
Normal file
File diff suppressed because it is too large
Load diff
100
input/2.txt
Normal file
100
input/2.txt
Normal file
|
@ -0,0 +1,100 @@
|
||||||
|
Game 1: 4 red, 18 green, 15 blue; 17 green, 18 blue, 9 red; 8 red, 14 green, 6 blue; 14 green, 12 blue, 2 red
|
||||||
|
Game 2: 6 red, 11 green; 4 blue, 4 green, 5 red; 11 green, 6 blue, 6 red
|
||||||
|
Game 3: 3 red, 3 green; 3 green, 1 blue, 7 red; 3 green, 5 red, 1 blue; 9 red, 4 green; 1 blue, 2 green, 5 red
|
||||||
|
Game 4: 2 blue, 5 green, 9 red; 7 red, 10 blue; 2 green, 14 blue, 5 red; 3 blue, 2 green; 4 green, 10 red, 7 blue; 2 green, 15 blue, 7 red
|
||||||
|
Game 5: 3 red, 2 blue; 5 red, 3 blue; 10 blue, 10 red, 1 green; 4 blue
|
||||||
|
Game 6: 1 green, 10 blue, 5 red; 8 blue, 9 green; 20 green, 7 red, 10 blue; 12 green, 6 blue, 6 red; 10 blue, 11 green; 8 blue, 17 green, 5 red
|
||||||
|
Game 7: 7 green, 12 blue, 3 red; 19 red, 12 blue; 8 blue, 8 red, 7 green; 6 red, 7 green, 5 blue
|
||||||
|
Game 8: 8 blue, 7 red; 13 green, 5 blue, 5 red; 11 blue, 4 green, 7 red; 5 blue, 6 red, 13 green; 7 blue, 12 green, 8 red
|
||||||
|
Game 9: 3 red, 3 blue, 12 green; 2 red, 1 blue, 9 green; 3 red, 12 green, 3 blue; 2 red, 7 green, 2 blue; 8 green, 4 blue; 2 red, 2 green
|
||||||
|
Game 10: 16 green, 10 red; 13 green, 7 red; 8 red, 1 blue, 8 green
|
||||||
|
Game 11: 7 red, 1 blue, 1 green; 6 blue, 1 green, 3 red; 5 blue, 10 red
|
||||||
|
Game 12: 1 green, 8 red, 5 blue; 6 red, 12 blue; 2 blue, 15 red; 14 blue, 15 red, 1 green; 8 red, 9 blue
|
||||||
|
Game 13: 1 green, 6 red; 7 blue, 13 red, 1 green; 3 blue, 4 red
|
||||||
|
Game 14: 11 red, 1 green, 1 blue; 3 blue, 18 red, 15 green; 10 blue, 5 green, 11 red
|
||||||
|
Game 15: 6 green, 10 blue, 15 red; 6 green, 17 blue, 8 red; 19 red, 7 blue, 2 green; 1 green, 18 red, 4 blue
|
||||||
|
Game 16: 1 green, 17 red, 7 blue; 12 red, 10 green, 9 blue; 15 red, 3 green, 15 blue
|
||||||
|
Game 17: 12 blue, 13 green; 16 green, 19 blue, 7 red; 1 green, 2 blue
|
||||||
|
Game 18: 8 blue, 9 green, 2 red; 9 blue, 7 green; 3 red, 9 green, 10 blue; 1 blue, 7 green, 2 red; 1 green, 8 blue, 4 red
|
||||||
|
Game 19: 3 green, 2 red, 11 blue; 13 blue, 3 green, 1 red; 1 red, 10 blue
|
||||||
|
Game 20: 2 red, 4 green, 1 blue; 14 blue, 7 green; 7 blue, 9 green; 4 red, 5 green, 7 blue
|
||||||
|
Game 21: 4 blue, 20 red, 7 green; 4 green, 6 blue, 14 red; 6 green, 18 red, 5 blue; 2 blue, 4 green, 6 red; 4 green, 16 red, 4 blue
|
||||||
|
Game 22: 13 red, 2 green; 6 red, 3 blue; 6 red, 2 green; 7 red, 1 green; 6 red, 2 green
|
||||||
|
Game 23: 5 blue; 6 red, 16 green, 12 blue; 1 blue, 6 green, 2 red; 8 red, 6 blue, 3 green
|
||||||
|
Game 24: 10 green, 4 blue, 5 red; 1 green, 3 red; 8 red, 3 blue, 6 green; 3 red, 2 blue; 3 red, 10 green, 3 blue
|
||||||
|
Game 25: 1 red, 2 green; 4 green, 6 red, 1 blue; 3 red; 4 green, 2 red
|
||||||
|
Game 26: 7 red, 1 blue; 2 red, 1 blue; 9 red, 1 green, 2 blue; 5 red, 2 blue; 4 red, 2 green; 8 red, 1 green, 2 blue
|
||||||
|
Game 27: 1 green, 2 red, 8 blue; 1 green, 4 red, 9 blue; 16 blue, 12 red, 3 green; 13 blue, 4 green, 5 red
|
||||||
|
Game 28: 8 blue, 8 green, 3 red; 8 green, 6 blue; 5 green, 6 blue, 4 red
|
||||||
|
Game 29: 7 red, 11 green, 5 blue; 1 green, 1 blue, 6 red; 6 green, 5 blue, 8 red; 7 blue, 15 green, 2 red; 10 blue, 1 red
|
||||||
|
Game 30: 7 red, 5 blue, 14 green; 2 blue, 11 red; 17 green, 2 blue, 7 red; 4 blue, 10 red, 5 green
|
||||||
|
Game 31: 17 blue, 5 red, 2 green; 7 red, 14 blue, 3 green; 13 blue, 5 red, 2 green; 12 green, 8 blue, 8 red
|
||||||
|
Game 32: 1 red, 7 blue; 1 red, 8 blue; 1 red, 2 green, 13 blue
|
||||||
|
Game 33: 1 green, 3 blue, 3 red; 4 red, 2 green; 5 blue, 1 red, 1 green; 1 red, 8 blue, 2 green
|
||||||
|
Game 34: 9 blue, 7 red; 9 green, 11 red, 1 blue; 18 red, 4 blue, 6 green
|
||||||
|
Game 35: 7 blue, 4 green, 2 red; 1 green, 1 blue, 2 red; 3 green; 3 blue, 7 green, 1 red; 7 blue, 12 green
|
||||||
|
Game 36: 17 red, 5 blue; 6 red, 5 green, 7 blue; 16 blue, 1 green, 7 red; 7 blue, 5 green, 15 red; 8 blue, 19 red, 1 green
|
||||||
|
Game 37: 4 blue, 6 red, 1 green; 9 red, 8 green, 4 blue; 1 green, 8 blue, 10 red; 11 green, 6 red, 9 blue
|
||||||
|
Game 38: 3 red, 4 blue; 5 red, 1 blue; 1 green, 2 red, 5 blue; 2 blue, 8 red; 7 red, 1 blue; 4 blue, 5 red
|
||||||
|
Game 39: 7 green; 5 green; 3 blue; 12 green, 1 red, 1 blue; 8 green, 1 blue, 1 red
|
||||||
|
Game 40: 12 red, 11 blue; 6 green, 2 blue, 13 red; 6 green, 7 red, 6 blue
|
||||||
|
Game 41: 3 green, 1 blue; 5 blue, 7 red, 6 green; 6 red, 14 blue; 9 red, 14 green, 5 blue; 5 blue, 6 green, 3 red; 20 green, 4 blue, 5 red
|
||||||
|
Game 42: 2 blue, 13 green; 10 red, 6 green; 8 green, 2 red; 7 red
|
||||||
|
Game 43: 7 green, 3 red; 6 red, 6 green, 13 blue; 7 green, 2 red, 9 blue; 8 blue, 3 green, 1 red; 10 green, 7 red, 13 blue
|
||||||
|
Game 44: 3 blue, 1 green, 2 red; 10 blue, 9 red; 5 red, 13 blue
|
||||||
|
Game 45: 11 red, 2 green, 5 blue; 1 green, 6 red, 6 blue; 17 red, 2 green, 6 blue; 14 red, 2 green
|
||||||
|
Game 46: 5 blue, 7 red, 8 green; 6 green, 1 red, 10 blue; 1 red, 5 blue, 4 green
|
||||||
|
Game 47: 5 green, 5 red, 1 blue; 11 green, 8 red, 6 blue; 2 green, 16 red, 1 blue; 12 green, 1 red, 7 blue; 2 red, 15 green, 7 blue
|
||||||
|
Game 48: 3 red, 6 green, 4 blue; 1 blue, 1 green, 2 red; 12 blue, 7 green, 5 red
|
||||||
|
Game 49: 4 blue, 1 green; 4 red, 2 blue; 3 blue, 2 green; 5 red, 3 blue, 4 green
|
||||||
|
Game 50: 1 blue, 1 green; 3 blue, 7 red, 1 green; 2 blue, 1 green
|
||||||
|
Game 51: 17 blue, 1 green, 3 red; 2 green, 1 red, 3 blue; 14 blue, 10 red
|
||||||
|
Game 52: 8 blue, 1 green; 1 blue, 3 red, 2 green; 2 green, 14 blue
|
||||||
|
Game 53: 9 green, 3 blue, 9 red; 3 blue, 7 red, 8 green; 2 green, 2 red; 17 green, 3 red; 18 green, 8 red
|
||||||
|
Game 54: 2 blue, 10 red; 2 green, 2 red; 6 green, 1 blue, 1 red; 3 blue, 6 red, 7 green
|
||||||
|
Game 55: 3 blue, 1 red; 1 green, 2 red, 1 blue; 4 blue, 3 red; 5 blue, 3 green; 3 green, 1 red, 3 blue; 2 green
|
||||||
|
Game 56: 10 green, 1 red, 6 blue; 16 green, 1 blue, 10 red; 8 red, 9 green, 2 blue; 3 red, 2 blue
|
||||||
|
Game 57: 1 blue, 4 green, 1 red; 7 red, 4 green, 8 blue; 9 red, 3 blue, 3 green
|
||||||
|
Game 58: 15 green, 16 blue, 8 red; 8 blue, 8 red, 2 green; 9 blue, 8 red, 3 green; 20 blue, 15 green, 7 red
|
||||||
|
Game 59: 13 red, 3 blue; 12 red, 4 green; 9 blue, 5 green, 9 red; 2 red, 12 blue, 1 green
|
||||||
|
Game 60: 14 green, 16 red; 5 green, 1 blue, 5 red; 14 green, 5 blue, 20 red; 2 blue, 8 green, 1 red
|
||||||
|
Game 61: 2 green, 10 red, 15 blue; 17 blue, 6 red, 2 green; 2 red, 2 green, 12 blue; 2 red, 2 green
|
||||||
|
Game 62: 8 blue, 1 green, 3 red; 6 red, 15 blue, 2 green; 5 green, 6 blue; 1 red, 7 green, 8 blue
|
||||||
|
Game 63: 13 green, 8 red; 8 green, 1 blue, 5 red; 2 green, 8 red, 2 blue
|
||||||
|
Game 64: 13 red, 12 blue, 4 green; 2 blue, 3 red, 1 green; 4 green, 14 red, 14 blue; 8 red, 4 green; 16 red; 5 blue, 16 red, 4 green
|
||||||
|
Game 65: 13 red, 2 blue, 3 green; 10 red, 6 blue; 6 blue, 5 red
|
||||||
|
Game 66: 1 blue, 9 green; 4 green, 5 blue; 8 green, 8 blue; 10 blue, 1 red, 10 green; 18 blue, 1 red, 9 green
|
||||||
|
Game 67: 12 red, 7 blue; 13 red, 3 blue, 3 green; 7 blue, 6 red, 4 green
|
||||||
|
Game 68: 3 green, 4 blue, 8 red; 1 green, 2 blue, 13 red; 3 green, 14 red, 4 blue; 6 red, 4 green; 7 blue, 2 red, 1 green; 1 green, 3 blue, 14 red
|
||||||
|
Game 69: 2 blue, 6 red, 2 green; 7 green, 18 red; 11 green, 1 blue, 13 red; 3 red, 6 green, 1 blue; 19 red, 1 green
|
||||||
|
Game 70: 13 green; 1 red, 14 green, 2 blue; 9 red, 1 blue, 9 green; 6 green, 5 red, 1 blue; 2 green, 10 red
|
||||||
|
Game 71: 7 blue, 5 green, 11 red; 4 red, 8 blue, 5 green; 1 green, 1 blue; 6 green, 8 red, 5 blue; 8 red, 7 green, 6 blue
|
||||||
|
Game 72: 2 blue, 2 green, 1 red; 5 green, 1 red, 3 blue; 4 green
|
||||||
|
Game 73: 8 green, 3 blue, 3 red; 1 green, 3 red, 9 blue; 3 red, 10 blue, 8 green; 10 green, 3 red, 8 blue; 3 blue, 3 green; 2 green
|
||||||
|
Game 74: 5 red, 1 green; 1 blue, 5 red; 8 red, 3 blue
|
||||||
|
Game 75: 5 red, 7 green, 3 blue; 1 red, 5 blue, 4 green; 2 blue, 12 green; 3 blue, 5 red; 8 green, 4 blue, 3 red; 1 green, 2 blue, 1 red
|
||||||
|
Game 76: 10 green, 5 blue, 1 red; 11 blue, 16 green, 1 red; 12 blue, 2 red, 18 green; 12 green, 10 blue; 5 blue, 5 green, 1 red; 9 green, 1 red, 1 blue
|
||||||
|
Game 77: 9 blue, 1 red, 2 green; 1 blue, 1 red, 5 green; 5 blue
|
||||||
|
Game 78: 1 red, 1 blue; 1 blue; 1 red; 1 green, 2 red, 1 blue; 1 blue, 4 red
|
||||||
|
Game 79: 3 green, 11 red, 4 blue; 7 red, 1 green, 4 blue; 1 green, 3 red, 3 blue; 3 blue, 3 red, 4 green; 3 green, 3 blue, 9 red
|
||||||
|
Game 80: 11 blue, 10 green, 11 red; 10 green, 9 red, 18 blue; 11 green, 17 blue, 7 red
|
||||||
|
Game 81: 6 red, 1 blue; 3 blue, 6 red, 2 green; 6 red, 10 green, 1 blue; 5 blue, 3 green, 3 red
|
||||||
|
Game 82: 6 red, 16 green, 2 blue; 9 green, 6 red, 3 blue; 1 blue, 9 red, 14 green; 8 green, 11 red, 3 blue; 3 red, 5 green; 12 green, 3 blue
|
||||||
|
Game 83: 7 blue, 5 green, 11 red; 8 red, 9 blue, 13 green; 13 blue, 8 red, 8 green; 2 blue, 9 green, 5 red
|
||||||
|
Game 84: 9 green, 14 red, 11 blue; 1 green, 12 blue, 6 red; 12 green, 10 red, 7 blue; 15 green, 6 blue; 15 blue, 4 red, 6 green; 16 green, 2 red, 13 blue
|
||||||
|
Game 85: 7 red, 7 blue, 3 green; 5 green, 1 blue; 6 red, 11 green, 7 blue
|
||||||
|
Game 86: 9 green, 6 blue, 6 red; 3 red, 2 blue, 7 green; 4 red, 4 green, 7 blue; 10 blue, 10 green, 2 red; 5 green
|
||||||
|
Game 87: 6 green, 5 blue; 15 blue, 9 green, 1 red; 14 blue, 15 green
|
||||||
|
Game 88: 3 blue, 2 green, 5 red; 8 blue, 1 green, 2 red; 5 red, 8 blue, 1 green; 1 red, 1 blue; 1 green, 6 red, 2 blue; 1 green, 2 red, 1 blue
|
||||||
|
Game 89: 4 blue, 3 green; 1 blue, 2 red; 2 red, 1 green, 4 blue; 2 red, 2 blue, 1 green
|
||||||
|
Game 90: 2 green, 1 red; 3 green, 8 red; 1 blue, 6 red, 4 green
|
||||||
|
Game 91: 3 red; 1 blue, 6 red; 1 blue, 5 red, 1 green
|
||||||
|
Game 92: 6 red, 9 green, 7 blue; 9 green, 4 red; 2 green, 5 blue
|
||||||
|
Game 93: 7 green, 1 red; 3 blue, 3 red; 3 green, 9 red, 4 blue; 2 red, 6 green; 5 red, 3 blue
|
||||||
|
Game 94: 4 green, 11 red; 13 green, 9 red; 16 green, 11 red; 6 green, 2 blue, 14 red; 17 green, 9 red
|
||||||
|
Game 95: 7 red, 13 blue, 2 green; 8 green, 13 blue, 3 red; 5 green, 6 red, 13 blue; 8 green, 8 blue, 2 red; 6 blue, 4 green, 8 red; 2 blue, 2 red
|
||||||
|
Game 96: 10 red, 3 blue, 3 green; 2 blue, 4 green, 5 red; 7 blue, 4 green, 6 red; 1 green, 4 red, 5 blue
|
||||||
|
Game 97: 5 red, 8 blue; 4 green, 2 red, 14 blue; 10 blue, 7 green
|
||||||
|
Game 98: 1 red, 2 green, 14 blue; 6 green, 1 blue; 19 blue, 4 red; 18 blue, 4 red, 3 green; 2 red, 1 blue
|
||||||
|
Game 99: 3 red, 4 blue; 7 red, 5 blue, 3 green; 2 green, 1 blue, 1 red; 4 blue, 2 green, 1 red; 1 green, 1 red, 2 blue; 1 green, 6 blue, 7 red
|
||||||
|
Game 100: 2 blue, 10 green; 10 green, 14 red; 3 green, 5 red, 2 blue; 1 red, 3 blue, 7 green; 1 blue, 7 red
|
140
input/3.txt
Normal file
140
input/3.txt
Normal file
|
@ -0,0 +1,140 @@
|
||||||
|
...................15....904...........850.................329...................13....................................871....816....697....
|
||||||
|
...........53.497........................%....906...610.......*.............735#..&...*......558...68...............68..*......&....*.......
|
||||||
|
..........*....$....................132.........*..........844....875................350............*...............*..336.364...649........
|
||||||
|
.......726.......341..................*...186...358..................*244........57.......@.........738......*.....663.................584..
|
||||||
|
.............952.*......33......660..704............949......................518*....234.967....551........971..&.......................*...
|
||||||
|
.......738...*....222......................706.......*..825.............474%...........*...........*.405.........779..............542...405.
|
||||||
|
.74.........366....................192..........542.737....*760...................623/..730.....718.../.....................$17......%......
|
||||||
|
...*126.....................%........*.504...=..*.........................................................974...............................
|
||||||
|
........331/..901.........337..........*...461.698...............*461.....814............................*............975...............165.
|
||||||
|
..../.........*.....................262.......................313........*........530.56.....567.......897.....*.........*.9................
|
||||||
|
....953....355...@703..................................609..............462.......%........./...............108.557...501.../...724.........
|
||||||
|
..............................................=.........%.......46......................533....670...............................*..%630....
|
||||||
|
.........................91...382*204.........154..%.............+.524.995..............=.....*...........7..........692.92*56...73.........
|
||||||
|
.685....*....70.189.......*.........................773...830/....../....*........=.........565.............464................$....738..130
|
||||||
|
.........938..*........993..............*.................................243...340...753...........*...882...............108.647....*......
|
||||||
|
..............762..........348.......280...............364*526...........................*........552.....=....25..682....*.........164.....
|
||||||
|
.....948..............813../....644......62........................................#.....657......................*.........................
|
||||||
|
......*...........................*.................$745.......739.....*...399...30............&..@...........924.117..........309..........
|
||||||
|
...883....544.....33.........585=.428.146................288.....*..853....*...........*891.409....429..460...*..........997....*........187
|
||||||
|
.............*818........829..........*....846..............................248.....574..................*....789.......*.....965....-..*...
|
||||||
|
......=.....................*..........370.......850+.............313...........................573....621...............268.......58..800..
|
||||||
|
....67....287.............481..709...............................*.......#74...................*.................965........................
|
||||||
|
............@.291.............*.........607*....950.475..309...66..932........395..374..........155.891....472..*......774.............&....
|
||||||
|
....207..........%..262......543..887/......711....*.......+......*............*...*........823............*...93...........377.....764.....
|
||||||
|
.....*...968.951.......#................................$.........453...366..736.972........*.............697........*618...&...............
|
||||||
|
....984..*...............-.......................884..23......492.....*..*................70..523.....25........$.....................370...
|
||||||
|
..................870...187.......548#.522..458.....*..........*....956......535....../.........*.525*........197....@..*266...123.....*....
|
||||||
|
.........501.....*..........................&.....323........257........956..*........80..946.592.................211.........*.........311.
|
||||||
|
.....380*.....867...653..347....................*........93=...........*......515..........-...................................678..........
|
||||||
|
..........876......&....*.......&631.950.647...631...@...........=...705..914................739..............319......713.........*97.#918.
|
||||||
|
.....805...*..........118................-.........790....559..51........../........*.........*......550......*........./.......647.........
|
||||||
|
......-..428.....599......813................413..................280............840.654.......91.....*...........236.......$...............
|
||||||
|
.............=...%.......*.....77...................#.492............................................96..........@.......175....%...........
|
||||||
|
......*427..569..........47......................999......314.....636*253.................764.................27......-..........415..386...
|
||||||
|
...142................$................@..320........969...................882*311...............#..751...........=....649...........*......
|
||||||
|
.........*723..993.976....638........475................=..800.......................*764.710...574....*964....831..........473......531....
|
||||||
|
...%..486...................*....#..................................831...........375........*........................=824......21..........
|
||||||
|
559.........................441...316................................./....................618.407.......83.......972...............91......
|
||||||
|
......*.....25..741...................%...............*63.546$..905......27........861.756........*.......*..........*...28...57............
|
||||||
|
.......794....*./........782...236....47...........937...........*..755....*505..............23.948.......560.532...421....*..#.........405.
|
||||||
|
............566.................*........-850..872.......90....229...+..........978..684............225..................675.....591...*....
|
||||||
|
.............................296..243...........+....691...................311.........$......321......@......827....$13.......$....&..530..
|
||||||
|
.....664..422$....613.....@.........%.401/.$974.....-.........%.145....729......*........./.......106............%.......=.....611..........
|
||||||
|
.......$.........*.......857...147*.............591........+.46..*.....=........306.67*...818.............................261....../........
|
||||||
|
............823...785..............340.........-....564..777......456.......%....................891.................560...........642..181.
|
||||||
|
.....394.....*................226..........423..............................539.................*............640&.............535...........
|
||||||
|
.......@.....626..317..329....*...92........+..................374....827............*.683+....771....529.........303..........*............
|
||||||
|
.........172.....-........*......*.....332...........288..229..+.........*.786=....468.............*....*...........*....461...249..=.......
|
||||||
|
....974...*............901..@....130..*..............$...*..........4.573................163......429....808.464*47..231....@......964......
|
||||||
|
........183.................582........11...............310.....774.*.....567.............*....36...........................................
|
||||||
|
.......................939.....................*826............@.....892..........481......266.*...-253.........106.830....235......*..841..
|
||||||
|
727.........177#.........&.......507........301..........................550..242*.....+./.....686.......@.446.*.....*.......*....894..*....
|
||||||
|
....67...............468.....&......&..596......................817.600...............85.5.............973...$.805...513......378.......388.
|
||||||
|
...........*247.........*.....974.........*263....329....476....*............721............723.....................................358.....
|
||||||
|
........784.....434.....667.......................*............615.195.612...............................540#........347...........*........
|
||||||
|
...............*.................76......121...659........@555..........-.............201......................866............628.505.509...
|
||||||
|
.............515........../.................#....................281..%...656............*670.419.......799.......*...510.786...*.......&...
|
||||||
|
....993.................540.373....709.............705............*...132..#........298$......*...232....*..@..878.......*....528...#.......
|
||||||
|
....$.........615.............*..........948..........*........565................%..........465..#.....497.67....................631.......
|
||||||
|
.........138....#....417......123...........*.......546...821...................114..=............................258.859=.380-.............
|
||||||
|
.....734*.............../.............833..399..........................+............780...288..............117..@...................925....
|
||||||
|
................*860..........228........*...............................956....390*........=..........%...*..........839...373......*......
|
||||||
|
..802........369........641.............763.....154.24...............302............620..............150.403.......*.........*....647.......
|
||||||
|
...................................&........466*.....@..................*827....530.............................129.628.....923.........=866
|
||||||
|
..........&......&.............824.573.................669.........................$.....374..627...........698.....................759.....
|
||||||
|
.......499....%.812.857*653...................668..........879.......974................../......*926...852.........................-....832
|
||||||
|
...646......284..............708...369...........*808................-.......705.......@...............%.............492.462............*...
|
||||||
|
....................959......#.......*....872..........................102....*.........80..839....996..............*.....%........83...49..
|
||||||
|
.785............363..*.............49.......*.......667.....797....224.......586..............&....*...34..673.......650....................
|
||||||
|
....*..*132....*.....225...................631..350..*.........*....*.............941....=.......52....*.................406...546..........
|
||||||
|
.543............760.........305..325...330.......+.................621...........*.......63..#.......268..239...................#...........
|
||||||
|
........658..................*............*...........735......820.....145....419...........91..489.........*......404.......*....#.........
|
||||||
|
..........=....415+.....38$....844...+..366.............*.......*......*..............................43....945.....#.....563.205..211..183.
|
||||||
|
......267.......................*...519.....730........836..........277...........808...........504...&................................#....
|
||||||
|
.....*..................705/....575..........*....../..........$866.........=.......*...975......#.......183.931........%.......611.........
|
||||||
|
.......135.......284........................246.653.972..............365..191.....376...*.....&.........*......*.........994...@.....11.....
|
||||||
|
...440../.........*.............................*..............415.....................985..838......677.......109...................*......
|
||||||
|
...@............224....399.727$......68#..........................$......432.....214$.....................#.................591....686......
|
||||||
|
..........&.......................................658........143....779.+....942......$.............885....567..........$...................
|
||||||
|
.461.......33....277.407......108..............47.*.............*...........*.......$.811............................390....................
|
||||||
|
..........................907*.....#397..307...*....197.12.....3...738....254.85..393...............713..700..741...........176.....883.....
|
||||||
|
..316........180...........................*.758...................-...........................................*............*...............
|
||||||
|
....*..../........871...338..165.........683............455...701*......................540....255.......$....858........277....28....+.....
|
||||||
|
...660.469..912...#..........%......743.........439.....-.........206......363..........*.......*.......640............................144..
|
||||||
|
..............*.........443...............610.............803.............*.............879...658............$................189...........
|
||||||
|
...........172......794........98..............646......................662..............................*....49.-210.523.257....*..........
|
||||||
|
...87..662.....#.......*667....%..408..........*............220...524............=.....742..39..160....64.636..........*..*....974..378.....
|
||||||
|
...*.....*.....42..&.............=....371*.....804.................*..#....../.240.....*........................395%..461..818.....*........
|
||||||
|
....706.398........452....500.............406..........57*380....365.42...635.......131...........18.....538.....................403........
|
||||||
|
..............143........*.........80............740..........................*245......784........-...........708...................&.297..
|
||||||
|
.230...........*.......373..341...........................$438.......*.................=.............874&..959*...........192......829.#....
|
||||||
|
...#..........476..647.....*......................................431.728..........................................50.....$.................
|
||||||
|
........334...........*731.930......=........966........*323...................301.....%....404...............879....*372.....208.134.......
|
||||||
|
...........*.....................163..........*......509......................%.....&..785.......................*...............*..........
|
||||||
|
...768..329....199........................................797......*368..........873..........26.565....651.....664......111..........217...
|
||||||
|
................*.....26.......705*76....415.............*................................749..........*..................#......545-..%....
|
||||||
|
....-....473..517......*...............5*....449..........68........................751.......*399......401.................................
|
||||||
|
.730......#.........240...&..65.718.87......*.....532..............-....567............*....................675.......67..463...............
|
||||||
|
.....289#....509........200......*...*....852....................885...+....663..72..507......998.&954..213....$.....*.........672..........
|
||||||
|
..............................403.....129........377-....................../....&.................................473...........*...........
|
||||||
|
.........855=.........250...................961........860*916.......981..........326.........633..404................676.%566..120.........
|
||||||
|
892...........532.............754.......866*....790..................#........819*..............*.........%.44..=......*............29......
|
||||||
|
....@527.......*..................600............../...$568.....800.....................179..528........613.....358...949...................
|
||||||
|
................302...807............*..895.................+.....@.....-...........................980...........................736.......
|
||||||
|
........217...=......*............879.....+.-..........%.....793.......442.......422............209*.......&.......969....240.378...*.......
|
||||||
|
....340*.....145...%.596....................23....703...217................372..........610.................129.......*........../.....=....
|
||||||
|
.................790.....&............904............=............795......*.......385=...+.....88*143...............891....406.......79....
|
||||||
|
............*749.........31..............*....318.................+.......317.................................%419.............*392.........
|
||||||
|
....854..797......*..500...............614.1...*..............803.....451............330.159.143.598.......+......./827...............717...
|
||||||
|
...@............924.*........................245............-.&..........*...606................*...........461............604....#....*....
|
||||||
|
....................73....160..406.150...............933.957...................%.......419.........665..*.........-.......*.....721..573....
|
||||||
|
....*915.........40................*...%.............*........584.......929......377....*..404.935....&..870.....93........395..............
|
||||||
|
.781.............@...........632.......710....769.323............$.........*.........904.....*...*.....................859..................
|
||||||
|
.....=.......................*...646............-.........................52................149...414....................*........%.........
|
||||||
|
...51....524.625..........328...*.................................295.734......@..........................856.291.695....367..218..787..8...
|
||||||
|
.........../.*................339........................576/.417*...........445...@........................%....................-..........
|
||||||
|
....869.85...316.....308...............345.......749.............................264.............775..777...............................89..
|
||||||
|
.......*...............#.........$....*..........*....../.....786.713*52.................357.......&./.........#......971....74.305....-....
|
||||||
|
............................325..770..167..@.....265..+..883................................+...57..........312.......*........*............
|
||||||
|
......+.....266.....788.111....*..........342........588.......939..393*717.............488....*....................401....249...255........
|
||||||
|
.......308..*............#.....816....465..........*.....492..@.............581.........-.......397..709*.................$.....*...........
|
||||||
|
.............511.....881...+.........+..........178..524*..............150..../..720.......843...........964....129.../......908............
|
||||||
|
.......749.............*.526.$............800............................*.........*...500....*.../.................487..........200........
|
||||||
|
..668......*639......932......139.726................#...51..436$..................775...*...834..874.......%..............859+......439....
|
||||||
|
........810........................*.......805.......100..*...........999.....743......169............477...961......973............$.......
|
||||||
|
.574...........6*262........398....204......*.....%.......525...........*.........................412..*.........376...*.@43....=......=....
|
||||||
|
....*836....................................25...619............658.....172.......................*...408...........*........%...776..802...
|
||||||
|
.............307.......&........537..988..............128..-.....*..........................118...327......296.......967..991...............
|
||||||
|
.....899...$...*....788.....829......=....................559.722.......519.........385$...+..................*.323*..............*123......
|
||||||
|
........*.930...674...........*..........447.......801..............957....................................111......767..34....556..........
|
||||||
|
..565.644..............18.....472.........*...8........................*........258........901.................296.......*..........*.......
|
||||||
|
....*............995=....*................649.*...151.........437%...445.747......-.........&......#......%.....*.........800....357.240....
|
||||||
|
....476.491/.931.......121..732*940..682......975..$.....*..................+.358.............../.363....152.264........$...................
|
||||||
|
.............=....730*..................*584...........234.........996.................*.....701........................499............649..
|
||||||
|
......................672......@.............................958.....&.+...........983.673........233.@981........760.......................
|
||||||
|
..942.993@......293...........939..&....@.........867..92.....*........679.........................*.............*.......27...998...........
|
||||||
|
....#.......230.$...................36.24....809..#....*...660.....$.......748..199.-.............717...@......................../..........
|
||||||
|
......*95..............647...$..............-.........461..........757...........*...68...............728..210*680..708......$.....246......
|
||||||
|
...355.........*..........*.538...%..............................-...............977....209*.......................*.........141.....*......
|
||||||
|
...............680.....670.........784........171..799.........317..........................844........166........289.................463...
|
55
src/main.rs
Normal file
55
src/main.rs
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#![allow(dead_code)]
|
||||||
|
use std::collections::HashMap;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
day3();
|
||||||
|
}
|
||||||
|
|
||||||
|
fn day1() {
|
||||||
|
let str_to_digit = HashMap::from([
|
||||||
|
("one", "o1e"), ("two", "t2o"), ("three", "t3e"), ("four", "4"),
|
||||||
|
("five", "5e"), ("six", "6"), ("seven", "7n"), ("eight", "e8t"), ("nine", "n9e")
|
||||||
|
]);
|
||||||
|
let input = std::fs::read_to_string("input/1.txt").unwrap();
|
||||||
|
let mut result = 0_u128;
|
||||||
|
for line in input.lines() {
|
||||||
|
let mut line = String::from(line);
|
||||||
|
for (str, digit) in str_to_digit.iter() { line = line.replace(str, digit); }
|
||||||
|
let mut digits_only = String::new();
|
||||||
|
for c in line.chars() { if c.is_digit(10) { digits_only.push(c); } }
|
||||||
|
let mut calibration = String::new();
|
||||||
|
calibration += &digits_only[..1];
|
||||||
|
calibration += &digits_only[digits_only.len() - 1..];
|
||||||
|
let value: u128 = calibration.parse().unwrap();
|
||||||
|
result += value;
|
||||||
|
}
|
||||||
|
println!("{}", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn day2() {
|
||||||
|
let input = std::fs::read_to_string("input/2.txt").unwrap();
|
||||||
|
let mut result = 0_u128;
|
||||||
|
for line in input.lines() {
|
||||||
|
let mut possible_game_cubes = HashMap::from([
|
||||||
|
("red", u8::MIN), ("green", u8::MIN), ("blue", u8::MIN)
|
||||||
|
]);
|
||||||
|
let (_, game_data) = line.split_once(':').unwrap();
|
||||||
|
for cubes in game_data.split(';') {
|
||||||
|
for colored_cubes in cubes.split(',') {
|
||||||
|
let (amount, color) = colored_cubes.trim().split_once(' ').unwrap();
|
||||||
|
let amount: u8 = amount.parse().unwrap();
|
||||||
|
possible_game_cubes.insert(color, possible_game_cubes[color].max(amount));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let power: u128 = possible_game_cubes.values().map(|e| *e as u128).product();
|
||||||
|
result += power;
|
||||||
|
}
|
||||||
|
println!("{}", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn day3() {
|
||||||
|
let input = std::fs::read_to_string("input/3.txt").unwrap();
|
||||||
|
let mut result = 0_u128;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue