There was an error while loading. Please reload this page.
1 parent 1782999 commit 3d8dbe8Copy full SHA for 3d8dbe8
src/main/kotlin/me/grison/aoc/y2022/Day15.kt
@@ -32,8 +32,9 @@ class Day15 : Day(15, 2022) {
32
33
override fun partTwo(): Long {
34
val data = data()
35
+ val max = 4_000_000L
36
- for (i in 3_000_000L..4_000_000L) {
37
+ for (i in (max - 1_000_000L)..max) {
38
val bounds = mutableListOf<LPosition>()
39
for ((sensor, beacon) in data) {
40
val distance = sensor.manhattan(beacon)
@@ -46,7 +47,7 @@ class Day15 : Day(15, 2022) {
46
47
var last = 0L
48
for ((bx, by) in bounds) {
49
if (bx > last)
- return i * 4_000_000L + bx.dec()
50
+ return i * max + bx.dec()
51
last = max(last, by);
52
}
53
0 commit comments