12 Commits c7d78d16d7 ... 3a4b5eb295

Author SHA1 Message Date
  Piotr Czajkowski 3a4b5eb295 Added description 22 hours ago
  Piotr Czajkowski f13107f62e Still nothing 22 hours ago
  Piotr Czajkowski ad1dd585fa Lost 1 day ago
  Piotr Czajkowski 9628e0e572 Better 1 day ago
  Piotr Czajkowski 2880b5f921 Closer, but no bisquit 1 day ago
  Piotr Czajkowski 4fda2d8c8c Simpler 1 day ago
  Piotr Czajkowski d5b5614200 Better 1 day ago
  Piotr Czajkowski 2df34a5f27 Added input 1 day ago
  Piotr Czajkowski e04918761e Nope 1 day ago
  Piotr Czajkowski 7ed6446774 Not yet 1 day ago
  Piotr Czajkowski 234707c399 Work in progress 1 day ago
  Piotr Czajkowski d1c4217570 Able to read input 1 day ago
3 changed files with 424 additions and 0 deletions
  1. 160 0
      20/code.go
  2. 123 0
      20/description.txt
  3. 141 0
      20/input

+ 160 - 0
20/code.go

@@ -0,0 +1,160 @@
+package main
+
+import (
+	"bufio"
+	"fmt"
+	"log"
+	"os"
+)
+
+type Point struct {
+	y, x      int
+	cost      int
+	cheatedAt *Point
+}
+
+func (p *Point) key() string {
+	return fmt.Sprintf("%d_%d", p.y, p.x)
+}
+
+func findPoint(line string, mark byte) *Point {
+	for i := range line {
+		if line[i] == mark {
+			return &Point{x: i}
+		}
+	}
+
+	return nil
+}
+
+func readInput(file *os.File) (*Point, [][]byte) {
+	scanner := bufio.NewScanner(file)
+	var matrix [][]byte
+	var start *Point
+
+	var y int
+	for scanner.Scan() {
+		line := scanner.Text()
+		if line == "" {
+			break
+		}
+
+		matrix = append(matrix, []byte(line))
+		if start == nil {
+			start = findPoint(line, 'S')
+			if start != nil {
+				start.y = y
+			}
+		}
+
+		y++
+	}
+
+	return start, matrix
+}
+
+var directions [][]int = [][]int{
+	{0, -1}, {1, 0}, {0, 1}, {-1, 0},
+}
+
+func getMoves(current Point, matrix [][]byte, xMax, yMax int, cheat bool, cheats map[string]bool) []Point {
+	var moves []Point
+	for _, direction := range directions {
+		move := Point{x: current.x + direction[0], y: current.y + direction[1], cost: current.cost + 1, cheatedAt: current.cheatedAt}
+		if move.x <= 0 || move.y <= 0 || move.x >= xMax || move.y >= yMax {
+			continue
+		}
+
+		if matrix[move.y][move.x] == '#' {
+			if cheat && !cheats[move.key()] && move.cheatedAt == nil {
+				move.cheatedAt = &move
+				moves = append(moves, move)
+			}
+
+			continue
+		}
+
+		moves = append(moves, move)
+	}
+
+	return moves
+}
+
+func hike(start *Point, matrix [][]byte, xMax, yMax int, cheat bool, cheats map[string]bool, bestWithoutCheating int, savings map[int]int) int {
+	cost := 1000000000
+	visited := make(map[string]int)
+	visited[start.key()] = start.cost
+
+	moves := []Point{*start}
+	for len(moves) > 0 {
+		current := moves[0]
+		moves = moves[1:]
+		if matrix[current.y][current.x] == 'E' {
+			if current.cost <= cost {
+				cost = current.cost
+				if cheat && current.cost < bestWithoutCheating {
+					saving := bestWithoutCheating - current.cost
+					savings[saving]++
+
+					cheats[current.cheatedAt.key()] = true
+				}
+			}
+
+			continue
+		}
+
+		newMoves := getMoves(current, matrix, xMax, yMax, cheat, cheats)
+		for _, newMove := range newMoves {
+			if cheat && newMove.cost >= bestWithoutCheating {
+				continue
+			}
+
+			if visited[newMove.key()] == 0 || visited[newMove.key()] >= newMove.cost {
+				moves = append(moves, newMove)
+				visited[newMove.key()] = newMove.cost
+			}
+		}
+	}
+
+	return cost
+}
+
+func part1(start *Point, matrix [][]byte, atLeast int) int {
+	xMax := len(matrix[0]) - 1
+	yMax := len(matrix) - 1
+
+	cheats := make(map[string]bool)
+	savings := make(map[int]int)
+	bestWithoutCheating := hike(start, matrix, xMax, yMax, false, cheats, 0, savings)
+	haltAt := bestWithoutCheating - atLeast
+	for {
+		score := hike(start, matrix, xMax, yMax, true, cheats, bestWithoutCheating, savings)
+		if score >= haltAt {
+			break
+		}
+	}
+
+	var count int
+	for key, value := range savings {
+		if key >= atLeast {
+			count += value
+		}
+	}
+
+	return count
+}
+
+func main() {
+	if len(os.Args) < 2 {
+		log.Fatal("You need to specify a file!")
+	}
+
+	filePath := os.Args[1]
+	file, err := os.Open(filePath)
+	if err != nil {
+		log.Fatalf("Failed to open %s!\n", filePath)
+	}
+
+	start, matrix := readInput(file)
+	fmt.Println("Part1:", part1(start, matrix, 100))
+}

+ 123 - 0
20/description.txt

@@ -0,0 +1,123 @@
+--- Day 20: Race Condition ---
+
+The Historians are quite pixelated again. This time, a massive, black building looms over you - you're right outside the CPU!
+
+While The Historians get to work, a nearby program sees that you're idle and challenges you to a race. Apparently, you've arrived just in time for the frequently-held race condition festival!
+
+The race takes place on a particularly long and twisting code path; programs compete to see who can finish in the fewest picoseconds. The winner even gets their very own mutex!
+
+They hand you a map of the racetrack (your puzzle input). For example:
+
+###############
+#...#...#.....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..E#...#...#
+###.#######.###
+#...###...#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############
+
+The map consists of track (.) - including the start (S) and end (E) positions (both of which also count as track) - and walls (#).
+
+When a program runs through the racetrack, it starts at the start position. Then, it is allowed to move up, down, left, or right; each such move takes 1 picosecond. The goal is to reach the end position as quickly as possible. In this example racetrack, the fastest time is 84 picoseconds.
+
+Because there is only a single path from the start to the end and the programs all go the same speed, the races used to be pretty boring. To make things more interesting, they introduced a new rule to the races: programs are allowed to cheat.
+
+The rules for cheating are very strict. Exactly once during a race, a program may disable collision for up to 2 picoseconds. This allows the program to pass through walls as if they were regular track. At the end of the cheat, the program must be back on normal track again; otherwise, it will receive a segmentation fault and get disqualified.
+
+So, a program could complete the course in 72 picoseconds (saving 12 picoseconds) by cheating for the two moves marked 1 and 2:
+
+###############
+#...#...12....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..E#...#...#
+###.#######.###
+#...###...#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############
+
+Or, a program could complete the course in 64 picoseconds (saving 20 picoseconds) by cheating for the two moves marked 1 and 2:
+
+###############
+#...#...#.....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..E#...12..#
+###.#######.###
+#...###...#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############
+
+This cheat saves 38 picoseconds:
+
+###############
+#...#...#.....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..E#...#...#
+###.####1##.###
+#...###.2.#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############
+
+This cheat saves 64 picoseconds and takes the program directly to the end:
+
+###############
+#...#...#.....#
+#.#.#.#.#.###.#
+#S#...#.#.#...#
+#######.#.#.###
+#######.#.#...#
+#######.#.###.#
+###..21...#...#
+###.#######.###
+#...###...#...#
+#.#####.#.###.#
+#.#...#.#.#...#
+#.#.#.#.#.#.###
+#...#...#...###
+###############
+
+Each cheat has a distinct start position (the position where the cheat is activated, just before the first move that is allowed to go through walls) and end position; cheats are uniquely identified by their start position and end position.
+
+In this example, the total number of cheats (grouped by the amount of time they save) are as follows:
+
+    There are 14 cheats that save 2 picoseconds.
+    There are 14 cheats that save 4 picoseconds.
+    There are 2 cheats that save 6 picoseconds.
+    There are 4 cheats that save 8 picoseconds.
+    There are 2 cheats that save 10 picoseconds.
+    There are 3 cheats that save 12 picoseconds.
+    There is one cheat that saves 20 picoseconds.
+    There is one cheat that saves 36 picoseconds.
+    There is one cheat that saves 38 picoseconds.
+    There is one cheat that saves 40 picoseconds.
+    There is one cheat that saves 64 picoseconds.
+
+You aren't sure what the conditions of the racetrack will be like, so to give yourself as many options as possible, you'll need a list of the best cheats. How many cheats would save you at least 100 picoseconds?

+ 141 - 0
20/input

@@ -0,0 +1,141 @@
+#############################################################################################################################################
+#.......#.........#.....#.....#...#...###...###.....###...#...###.....#.....#.......#.......#.....#...#####.....#...#...#...#...............#
+#.#####.#.#######.#.###.#.###.#.#.#.#.###.#.###.###.###.#.#.#.###.###.#.###.#.#####.#.#####.#.###.#.#.#####.###.#.#.#.#.#.#.#.#############.#
+#...#...#.......#.#...#.#...#.#.#...#...#.#...#...#.....#.#.#...#...#.#...#.#.....#.#...#...#.#...#.#...#...#...#.#...#.#.#.#...#...........#
+###.#.#########.#.###.#.###.#.#.#######.#.###.###.#######.#.###.###.#.###.#.#####.#.###.#.###.#.###.###.#.###.###.#####.#.#.###.#.###########
+#...#.....#.....#.#...#.#...#.#.......#.#.#...###.#.......#.#...#...#.....#.......#...#.#...#.#...#.#...#...#.###.....#...#...#.#...........#
+#.#######.#.#####.#.###.#.###.#######.#.#.#.#####.#.#######.#.###.###################.#.###.#.###.#.#.#####.#.#######.#######.#.###########.#
+#...#.....#.....#.#.#...#...#...#...#.#...#...#...#.......#.#...#...........#.......#...#...#.#...#.#...#...#...#...#.#.......#.#.........#.#
+###.#.#########.#.#.#.#####.###.#.#.#.#######.#.#########.#.###.###########.#.#####.#####.###.#.###.###.#.#####.#.#.#.#.#######.#.#######.#.#
+###.#.###.....#.#.#.#.#...#.#...#.#.#...#.....#.....#.....#.#...#...###...#...#...#.#.....#...#...#.#...#...#...#.#.#.#.###...#.#.#.....#.#.#
+###.#.###.###.#.#.#.#.#.#.#.#.###.#.###.#.#########.#.#####.#.###.#.###.#.#####.#.#.#.#####.#####.#.#.#####.#.###.#.#.#.###.#.#.#.#.###.#.#.#
+#...#...#...#.#.#.#.#.#.#...#.#...#.....#...###.....#...#...#...#.#.#...#.###...#...#...###.....#.#.#.#.....#...#.#.#.#.....#...#...#...#...#
+#.#####.###.#.#.#.#.#.#.#####.#.###########.###.#######.#.#####.#.#.#.###.###.#########.#######.#.#.#.#.#######.#.#.#.###############.#######
+#.....#.....#...#.#.#.#.....#.#...........#...#.#.....#.#.....#.#.#.#.#...#...#.......#.#...###.#.#.#.#.....#...#.#...#.............#.......#
+#####.###########.#.#.#####.#.###########.###.#.#.###.#.#####.#.#.#.#.#.###.###.#####.#.#.#.###.#.#.#.#####.#.###.#####.###########.#######.#
+#...#.........#...#.#.#...#.#...#...#...#.#...#.#...#...#.....#.#.#...#.###...#.#.....#...#...#.#.#.#.....#.#.###.#...#...........#...#.....#
+#.#.#########.#.###.#.#.#.#.###.#.#.#.#.#.#.###.###.#####.#####.#.#####.#####.#.#.###########.#.#.#.#####.#.#.###.#.#.###########.###.#.#####
+#.#...........#...#.#.#.#.#...#...#.#.#.#.#.....#...#...#...#...#...#...#...#...#...#.....#...#.#...#.....#.#...#.#.#.......#...#...#.#.....#
+#.###############.#.#.#.#.###.#####.#.#.#.#######.###.#.###.#.#####.#.###.#.#######.#.###.#.###.#####.#####.###.#.#.#######.#.#.###.#.#####.#
+#...#.....#.....#...#...#...#.....#.#.#.#.#.......#...#.....#...#...#...#.#...#...#.#...#...###.....#.#...#...#.#.#.#...###.#.#.#...#.......#
+###.#.###.#.###.###########.#####.#.#.#.#.#.#######.###########.#.#####.#.###.#.#.#.###.###########.#.#.#.###.#.#.#.#.#.###.#.#.#.###########
+###...###...#...#...#...#...#...#.#.#.#.#.#...#...#.........#...#.....#.#.#...#.#...#...#...#...#...#...#.....#...#...#...#.#.#...#...#...###
+#############.###.#.#.#.#.###.#.#.#.#.#.#.###.#.#.#########.#.#######.#.#.#.###.#####.###.#.#.#.#.#######################.#.#.#####.#.#.#.###
+#.............#...#...#.#...#.#.#.#.#.#.#.#...#.#.#...###...#.#...#...#...#...#...#...#...#.#.#.#.....#.........#.........#.#.....#.#.#.#...#
+#.#############.#######.###.#.#.#.#.#.#.#.#.###.#.#.#.###.###.#.#.#.#########.###.#.###.###.#.#.#####.#.#######.#.#########.#####.#.#.#.###.#
+#.#.............###...#...#.#.#...#...#...#.....#.#.#.#...#...#.#.#...#.......#...#...#.#...#.#.#...#.#.......#.#.......###.......#.#.#.#...#
+#.#.###############.#.###.#.#.###################.#.#.#.###.###.#.###.#.#######.#####.#.#.###.#.#.#.#.#######.#.#######.###########.#.#.#.###
+#...#...#...........#.....#...#...#...#...#.......#.#.#...#...#.#.#...#.#.....#.....#.#.#...#.#.#.#...#.......#...#...#.......#.....#...#...#
+#####.#.#.#####################.#.#.#.#.#.#.#######.#.###.###.#.#.#.###.#.###.#####.#.#.###.#.#.#.#####.#########.#.#.#######.#.###########.#
+#...#.#.#.........#.......#.....#...#...#.#.#...###.#.#...#...#.#.#...#...#...#.....#.#...#.#.#.#.#...#...###...#...#.........#...#.....#...#
+#.#.#.#.#########.#.#####.#.#############.#.#.#.###.#.#.###.###.#.###.#####.###.#####.###.#.#.#.#.#.#.###.###.#.#################.#.###.#.###
+#.#...#.......#...#.#.....#...#...#...#...#...#.#...#.#...#...#.#...#.#...#...#.....#...#.#...#.#...#.#...#...#.......###...#...#.#...#.#...#
+#.###########.#.###.#.#######.#.#.#.#.#.#######.#.###.###.###.#.###.#.#.#.###.#####.###.#.#####.#####.#.###.#########.###.#.#.#.#.###.#.###.#
+#.........#...#.....#.........#.#...#.#.#.......#...#.###.#...#.#...#...#.#...#...#.#...#.#.....#...#.#.###.#.......#.#...#...#.#.#...#.....#
+#########.#.###################.#####.#.#.#########.#.###.#.###.#.#######.#.###.#.#.#.###.#.#####.#.#.#.###.#.#####.#.#.#######.#.#.#########
+###...###.#.#...#...#.........#.....#...#...#.....#.#.#...#.#...#...#...#.#.....#.#.#.#...#...#...#...#.....#.....#.#.#...#.....#.#.....#...#
+###.#.###.#.#.#.#.#.#.#######.#####.#######.#.###.#.#.#.###.#.#####.#.#.#.#######.#.#.#.#####.#.#################.#.#.###.#.#####.#####.#.#.#
+#...#.....#...#.#.#.#.....#...#...#.......#.#.#...#.#.#...#.#.....#.#.#.#.....###.#.#.#.#.....#.....###.........#.#...###.#.......#...#...#.#
+#.#############.#.#.#####.#.###.#.#######.#.#.#.###.#.###.#.#####.#.#.#.#####.###.#.#.#.#.#########.###.#######.#.#######.#########.#.#####.#
+#.#...........#...#.......#.#...#.#.......#.#.#...#.#.#...#.#.....#.#.#.#...#.#...#.#.#.#...#.....#...#.......#...#.......#.........#.....#.#
+#.#.#########.#############.#.###.#.#######.#.###.#.#.#.###.#.#####.#.#.#.#.#.#.###.#.#.###.#.###.###.#######.#####.#######.#############.#.#
+#...#.....###.............#.#...#...#.....#...###.#.#.#.#...#...#...#.#.#.#.#.#...#.#...#...#.###.#...#.....#...#...#...#...#...#...#...#...#
+#####.###.###############.#.###.#####.###.#######.#.#.#.#.#####.#.###.#.#.#.#.###.#.#####.###.###.#.###.###.###.#.###.#.#.###.#.#.#.#.#.#####
+#...#...#.....#...........#.....#...#.#...#.....#...#...#...#...#...#.#.#.#.#S###.#.....#...#...#...###...#...#...#...#.#.....#.#.#...#...###
+#.#.###.#####.#.#################.#.#.#.###.###.###########.#.#####.#.#.#.#.#####.#####.###.###.#########.###.#####.###.#######.#.#######.###
+#.#.###.....#...#...#.....#.......#...#...#.#...#...#.......#.#...#...#...#...###.#.....#...#...#...#...#...#.#...#...#.........#.......#...#
+#.#.#######.#####.#.#.###.#.#############.#.#.###.#.#.#######.#.#.###########.###.#.#####.###.###.#.#.#.###.#.#.#.###.#################.###.#
+#.#.#...#...#...#.#.#.###.#.###.........#...#.....#.#.#.....#...#.......#.....###.#...#...#...###.#...#.....#...#.....#.....#...#.......#...#
+#.#.#.#.#.###.#.#.#.#.###.#.###.#######.###########.#.#.###.###########.#.#######.###.#.###.#####.#####################.###.#.#.#.#######.###
+#.#.#.#.#...#.#...#...#...#.#...#.....#.#...#...#...#.#.#...#.....#...#.#.#...###.#...#...#.....#...#...........###...#...#.#.#.#.#.......###
+#.#.#.#.###.#.#########.###.#.###.###.#.#.#.#.#.#.###.#.#.###.###.#.#.#.#.#.#.###.#.#####.#####.###.#.#########.###.#.###.#.#.#.#.#.#########
+#.#...#...#...###...###...#.#.....#...#.#.#...#...###...#...#...#.#.#...#...#.###.#.#.....#...#.#...#.#.........#...#...#.#...#...#...#...###
+#.#######.#######.#.#####.#.#######.###.#.#################.###.#.#.#########.###.#.#.#####.#.#.#.###.#.#########.#####.#.###########.#.#.###
+#.......#.....#...#.#.....#.#.......###...#.........#.......#...#...###...#...###...#...#...#...#.....#...........#...#.#.#...........#.#...#
+#######.#####.#.###.#.#####.#.#############.#######.#.#######.#########.#.#.###########.#.#########################.#.#.#.#.###########.###.#
+#...###.#.....#...#...#...#.#...#...#.....#.#.......#.....#...###...#...#.#...#######...#.###.................#...#.#...#.#...#...#.....#...#
+#.#.###.#.#######.#####.#.#.###.#.#.#.###.#.#.###########.#.#####.#.#.###.###.#######.###.###.###############.#.#.#.#####.###.#.#.#.#####.###
+#.#.....#.....###...#...#...###...#...#...#.#.....###...#.#...#...#.#...#.....#######...#.#...#.......#.....#.#.#...#...#.#...#.#...#...#...#
+#.###########.#####.#.#################.###.#####.###.#.#.###.#.###.###.###############.#.#.###.#####.#.###.#.#.#####.#.#.#.###.#####.#.###.#
+#...#.......#.#...#...###...#...#.......###.#.....#...#.#.....#...#.#...#.....#######...#.#...#.#.....#.#...#...#.....#...#.....#.....#.....#
+###.#.#####.#.#.#.#######.#.#.#.#.#########.#.#####.###.#########.#.#.###.###.#######.###.###.#.#.#####.#.#######.###############.###########
+#...#.#...#.#.#.#.........#.#.#.#.......#...#.....#...#.#...#...#.#...#...#...#######...#.###...#.......#.........#.......#.....#...........#
+#.###.#.#.#.#.#.###########.#.#.#######.#.#######.###.#.#.#.#.#.#.#####.###.###########.#.#########################.#####.#.###.###########.#
+#.#...#.#...#...#.........#...#.........#.#.....#...#.#.#.#.#.#.#.#...#...#...#...###E#...#...###...........#.....#.....#.#...#.#.....#.....#
+#.#.###.#########.#######.###############.#.###.###.#.#.#.#.#.#.#.#.#.###.###.#.#.###.#####.#.###.#########.#.###.#####.#.###.#.#.###.#.#####
+#...###.....#...#.#...###.................#.###.....#.#...#.#.#.#...#.#...#...#.#.#...#.....#.#...#...#...#...###.......#.#...#.#...#.#.....#
+###########.#.#.#.#.#.#####################.#########.#####.#.#.#####.#.###.###.#.#.###.#####.#.###.#.#.#.###############.#.###.###.#.#####.#
+#...###...#...#...#.#.#...#...#...#...#...#...#.......#...#...#.....#...###...#.#...###.....#.#...#.#...#.......#.......#.#...#...#.#...#...#
+#.#.###.#.#########.#.#.#.#.#.#.#.#.#.#.#.###.#.#######.#.#########.#########.#.###########.#.###.#.###########.#.#####.#.###.###.#.###.#.###
+#.#.#...#...#...#...#...#...#...#...#...#...#...#.....#.#.........#.#.....###...#.....#...#.#.###...#...........#.#.....#.....#...#...#...###
+#.#.#.#####.#.#.#.#########################.#####.###.#.#########.#.#.###.#######.###.#.#.#.#.#######.###########.#.###########.#####.#######
+#.#.#.....#.#.#.#.......................###.#.....###.#.........#...#...#.......#...#.#.#...#.#...###.............#.....###...#...#...#...###
+#.#.#####.#.#.#.#######################.###.#.#######.#########.#######.#######.###.#.#.#####.#.#.#####################.###.#.###.#.###.#.###
+#.#.#...#.#...#.......................#...#...#.....#...........#...#...#.......#...#.#.....#.#.#.#...###.....#.......#.....#...#...#...#...#
+#.#.#.#.#.###########################.###.#####.###.#############.#.#.###.#######.###.#####.#.#.#.#.#.###.###.#.#####.#########.#####.#####.#
+#.#...#...#...#.......#.....#...#...#.....#...#.#...###...#...###.#.#...#.....###...#.###...#...#...#.....###.#.....#...#...#...#...#...#...#
+#.#########.#.#.#####.#.###.#.#.#.#.#######.#.#.#.#####.#.#.#.###.#.###.#####.#####.#.###.###################.#####.###.#.#.#.###.#.###.#.###
+#...#.....#.#.#.#.....#.#...#.#...#.....###.#.#.#.......#.#.#.#...#...#.#.....#...#.#.....#.....#...#.......#.#...#.###...#...#...#.....#...#
+###.#.###.#.#.#.#.#####.#.###.#########.###.#.#.#########.#.#.#.#####.#.#.#####.#.#.#######.###.#.#.#.#####.#.#.#.#.###########.###########.#
+#...#...#.#.#.#.#...#...#...#.#.........#...#...#...#.....#.#.#.....#.#.#.#...#.#.#.......#...#...#.#.#.....#...#.#.#...#...#...#...#.......#
+#.#####.#.#.#.#.###.#.#####.#.#.#########.#######.#.#.#####.#.#####.#.#.#.#.#.#.#.#######.###.#####.#.#.#########.#.#.#.#.#.#.###.#.#.#######
+#.......#...#...###...#####...#...........#...#...#...###...#...###.#.#.#.#.#...#...#.....#...#...#...#...#...###.#...#...#...#...#.#.......#
+###########################################.#.#.#########.#####.###.#.#.#.#.#######.#.#####.###.#.#######.#.#.###.#############.###.#######.#
+#.........#.....###.....#.......#.......#...#.#.#...#...#.....#.....#.#.#.#.#.......#.......###.#...#...#...#...#...............###.#.......#
+#.#######.#.###.###.###.#.#####.#.#####.#.###.#.#.#.#.#.#####.#######.#.#.#.#.#################.###.#.#.#######.###################.#.#######
+#.......#.#...#.....#...#.....#.#.....#.#...#...#.#.#.#.#...#.......#.#.#.#.#.....#.....#.....#...#.#.#.......#...................#...###...#
+#######.#.###.#######.#######.#.#####.#.###.#####.#.#.#.#.#.#######.#.#.#.#.#####.#.###.#.###.###.#.#.#######.###################.#######.#.#
+#.......#.###.......#.#...#...#.......#.....#...#.#.#.#.#.#...#.....#...#.#.#.....#...#.#...#.###.#.#.......#.#...............#...###...#.#.#
+#.#######.#########.#.#.#.#.#################.#.#.#.#.#.#.###.#.#########.#.#.#######.#.###.#.###.#.#######.#.#.#############.#.#####.#.#.#.#
+#.......#.#...#.....#...#...#.............###.#...#...#.#...#.#.........#.#.#.....#...#.#...#.....#.....#...#...#.......#...#...#...#.#...#.#
+#######.#.#.#.#.#############.###########.###.#########.###.#.#########.#.#.#####.#.###.#.#############.#.#######.#####.#.#.#####.#.#.#####.#
+#...#...#...#...#.............#...........#...#.......#.#...#.#...#...#.#.#.#.....#...#...#.....#.....#...###.....#.....#.#...#...#.#.#.....#
+#.#.#.###########.#############.###########.###.#####.#.#.###.#.#.#.#.#.#.#.#.#######.#####.###.#.###.#######.#####.#####.###.#.###.#.#.#####
+#.#...#.......#...###...........#...#...###...#.....#.#.#...#.#.#.#.#...#...#...#...#...#...###...#...#.......#.....#.....#...#.#...#.#.#...#
+#.#####.#####.#.#####.###########.#.#.#.#####.#####.#.#.###.#.#.#.#.###########.#.#.###.#.#########.###.#######.#####.#####.###.#.###.#.#.#.#
+#...#...#.....#.#...#...........#.#.#.#.....#.#.....#...###.#.#.#.#...#...#...#.#.#...#...#.......#.....#...#...#...#.#.....#...#.....#...#.#
+###.#.###.#####.#.#.###########.#.#.#.#####.#.#.###########.#.#.#.###.#.#.#.#.#.#.###.#####.#####.#######.#.#.###.#.#.#.#####.#############.#
+#...#.#...#...#.#.#.#.........#...#...#.....#.#...#...###...#.#.#...#...#.#.#...#.#...#...#.....#.........#...###.#...#.......#...#...#...#.#
+#.###.#.###.#.#.#.#.#.#######.#########.#####.###.#.#.###.###.#.###.#####.#.#####.#.###.#.#####.#################.#############.#.#.#.#.#.#.#
+#...#.#...#.#.#.#.#...#.....#...#.......#...#.#...#.#.#...#...#.#...#.....#...#...#...#.#.#...#...#.............#...#...........#.#.#.#.#.#.#
+###.#.###.#.#.#.#.#####.###.###.#.#######.#.#.#.###.#.#.###.###.#.###.#######.#.#####.#.#.#.#.###.#.###########.###.#.###########.#.#.#.#.#.#
+###...#...#.#.#.#.#...#...#...#.#.........#.#.#...#.#.#...#...#.#...#.......#.#.....#.#.#.#.#.###...###.........#...#...........#...#.#.#...#
+#######.###.#.#.#.#.#.###.###.#.###########.#.###.#.#.###.###.#.###.#######.#.#####.#.#.#.#.#.#########.#########.#############.#####.#.#####
+###...#.....#...#...#.....#...#.............#.#...#.#.###.#...#...#.###...#.#.#...#.#.#.#.#.#.#...#...#...........#.......#...#...###.#.....#
+###.#.#####################.#################.#.###.#.###.#.#####.#.###.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#############.#####.#.#.###.###.#####.#
+#...#.......###.......#...#.........#.......#.#.#...#...#.#...#...#...#.#.#.#.#.#.#.#.#.#.#.#.#.#...#.#.....#.......#...#...#...#...#.......#
+#.#########.###.#####.#.#.#########.#.#####.#.#.#.#####.#.###.#.#####.#.#.#.#.#.#.#.#.#.#.#.#.#.#####.#.###.#.#######.#.#######.###.#########
+#.........#.....#...#...#.........#.#...###.#.#...#...#.#...#.#.#.....#.#...#.#.#...#.#.#...#.#.###...#.#...#.........#.......#...#.#.......#
+#########.#######.#.#############.#.###.###.#.#####.#.#.###.#.#.#.#####.#####.#.#####.#.#####.#.###.###.#.###################.###.#.#.#####.#
+###.....#.......#.#.............#...#...#...#.......#.#...#.#...#...#...#.....#.#.....#.#.....#...#...#.#...#...#...........#.#...#...#.....#
+###.###.#######.#.#############.#####.###.###########.###.#.#######.#.###.#####.#.#####.#.#######.###.#.###.#.#.#.#########.#.#.#######.#####
+#...#...#.....#...###...........#.....#...#.....#.....###.#.....###.#.###...#...#.#...#.#...#.....#...#...#.#.#.#.....#...#...#.......#.....#
+#.###.###.###.#######.###########.#####.###.###.#.#######.#####.###.#.#####.#.###.#.#.#.###.#.#####.#####.#.#.#.#####.#.#.###########.#####.#
+#...#...#...#.#.......#.....#...#.#.....#...###.#.......#...#...#...#.....#.#...#.#.#...###.#...###...#...#...#.#...#...#...........#...#...#
+###.###.###.#.#.#######.###.#.#.#.#.#####.#####.#######.###.#.###.#######.#.###.#.#.#######.###.#####.#.#######.#.#.###############.###.#.###
+#...#...#...#...#...#...#...#.#.#.#.....#.....#...#.....###...###.#.....#.#...#.#.#.......#...#...#...#.#...###...#...#.....#.......#...#...#
+#.###.###.#######.#.#.###.###.#.#.#####.#####.###.#.#############.#.###.#.###.#.#.#######.###.###.#.###.#.#.#########.#.###.#.#######.#####.#
+#...#.....#...#...#.#.###...#.#...#...#.#...#.#...#.......#.......#...#.#.#...#.#.#.....#...#.#...#...#...#.....#.....#...#.#.......#...#...#
+###.#######.#.#.###.#.#####.#.#####.#.#.#.#.#.#.#########.#.#########.#.#.#.###.#.#.###.###.#.#.#####.#########.#.#######.#.#######.###.#.###
+###...#...#.#.#.###...#.....#...#...#...#.#...#...#...#...#...#...#...#.#.#...#.#...###...#.#...#...#...#.......#.#.......#.#.......#...#...#
+#####.#.#.#.#.#.#######.#######.#.#######.#######.#.#.#.#####.#.#.#.###.#.###.#.#########.#.#####.#.###.#.#######.#.#######.#.#######.#####.#
+#.....#.#.#.#.#.#.....#.....#...#...#...#.....###...#.#.....#.#.#.#.###...#...#.....#.....#...#...#.....#.......#.#.....#...#.....###.......#
+#.#####.#.#.#.#.#.###.#####.#.#####.#.#.#####.#######.#####.#.#.#.#.#######.#######.#.#######.#.###############.#.#####.#.#######.###########
+#...#...#.#.#...#...#.#.....#.#####...#.#...#.....###.#.....#...#.#...#.....#.......#.......#.#.#...#...#.......#...#...#.........#.........#
+###.#.###.#.#######.#.#.#####.#########.#.#.#####.###.#.#########.###.#.#####.#############.#.#.#.#.#.#.#.#########.#.#############.#######.#
+###.#...#.#.#.......#...#...#...#.......#.#.#.....#...#...#.......#...#.....#.....#.........#.#.#.#.#.#.#.......#...#.........###...#...#...#
+###.###.#.#.#.###########.#.###.#.#######.#.#.#####.#####.#.#######.#######.#####.#.#########.#.#.#.#.#.#######.#.###########.###.###.#.#.###
+#...#...#...#.....#...#...#...#.#...#...#.#.#.....#.#...#.#.........#...###.#...#.#.#.......#.#...#.#.#.#.......#.....#.....#.....#...#.#...#
+#.###.###########.#.#.#.#####.#.###.#.#.#.#.#####.#.#.#.#.###########.#.###.#.#.#.#.#.#####.#.#####.#.#.#.###########.#.###.#######.###.###.#
+#...#.....#####...#.#.#.....#.#.#...#.#.#.#...#...#...#.#.....#.......#.....#.#.#.#...#.....#...#...#.#.#...........#.#...#.#...#...#...#...#
+###.#####.#####.###.#.#####.#.#.#.###.#.#.###.#.#######.#####.#.#############.#.#.#####.#######.#.###.#.###########.#.###.#.#.#.#.###.###.###
+#...#...#...#...#...#.....#.#...#...#.#.#.###.#.......#...#...#.....#...#...#.#.#.....#.#...#...#...#.#.#.....#...#.#.#...#...#...###.#...###
+#.###.#.###.#.###.#######.#.#######.#.#.#.###.#######.###.#.#######.#.#.#.#.#.#.#####.#.#.#.#.#####.#.#.#.###.#.#.#.#.#.#############.#.#####
+#.....#.....#...#.......#.#.#.......#.#...#...#...#...###.#...#.....#.#...#.#.#.#.....#...#.#.#...#...#.#...#.#.#.#.#.#.............#...#...#
+###############.#######.#.#.#.#######.#####.###.#.#.#####.###.#.#####.#####.#.#.#.#########.#.#.#.#####.###.#.#.#.#.#.#############.#####.#.#
+###...#.........#...#...#...#.....#...###...#...#...###...#...#.#...#...#...#.#.#...#.......#...#.###...#...#.#.#.#.#.#...#...#...#.....#.#.#
+###.#.#.#########.#.#.###########.#.#####.###.#########.###.###.#.#.###.#.###.#.###.#.###########.###.###.###.#.#.#.#.#.#.#.#.#.#.#####.#.#.#
+#...#...#.....#...#.#...#.........#.....#...#.........#...#...#.#.#...#.#...#.#...#.#.#.....#...#.#...#...#...#.#.#.#.#.#.#.#.#.#.#...#...#.#
+#.#######.###.#.###.###.#.#############.###.#########.###.###.#.#.###.#.###.#.###.#.#.#.###.#.#.#.#.###.###.###.#.#.#.#.#.#.#.#.#.#.#.#####.#
+#.........###...###.....#...............###...........###.....#...###...###...###...#...###...#...#.....###.....#...#...#...#...#...#.......#
+#############################################################################################################################################