Bitset is even faster (<1 sec).
This commit is contained in:
parent
0d5809398c
commit
e00e002cd6
@ -6,6 +6,7 @@ import kotlinx.coroutines.awaitAll
|
|||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import println
|
import println
|
||||||
import readInput
|
import readInput
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
/*
|
/*
|
||||||
--- Day 22: Monkey Market ---
|
--- Day 22: Monkey Market ---
|
||||||
@ -76,7 +77,7 @@ fun main() {
|
|||||||
var lastd = 0
|
var lastd = 0
|
||||||
var code = 0
|
var code = 0
|
||||||
var countDown = 4
|
var countDown = 4
|
||||||
val seenArray = BooleanArray(19 * 19 * 19 * 19)
|
val seenArray = BitSet(19 * 19 * 19 * 19)
|
||||||
for (v in priceSequence(it).take(2001)) {
|
for (v in priceSequence(it).take(2001)) {
|
||||||
val d = v % 10
|
val d = v % 10
|
||||||
val delta = d - lastd
|
val delta = d - lastd
|
||||||
|
Loading…
Reference in New Issue
Block a user