Skip to content

Commit 4dcf079

Browse files
committed
Added day19 part 2
1 parent 4b69a2d commit 4dcf079

File tree

6 files changed

+18
-4
lines changed

6 files changed

+18
-4
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44

55
// project meta data
66
group 'de.havox_design.aoc2023'
7-
version '0.18.5'
7+
version '0.18.6'
88

99
// Switch to gradle "all" distribution.
1010
wrapper {

day19/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,17 @@ Adding all of the ratings for **all** of the accepted parts gives the sum total
6666

6767
Sort through all of the parts you've been given; **what do you get if you add together all of the rating numbers for
6868
all of the parts that ultimately get accepted**?
69+
70+
# Part Two
71+
Even with your help, the sorting process **still** isn't fast enough.
72+
73+
One of the Elves comes up with a new plan: rather than sort parts individually through all of these workflows, maybe
74+
you can figure out in advance which combinations of ratings will be accepted or rejected.
75+
76+
Each of the four ratings (`x`, `m`, `a`, `s`) can have an integer value ranging from a minimum of `1` to a maximum of
77+
`4000`. Of **all possible distinct combinations** of ratings, your job is to figure out which ones will be **accepted**.
78+
79+
In the above example, there are **`167409079868000`** distinct combinations of ratings that will be accepted.
80+
81+
Consider only your list of workflows; the list of part ratings that the Elves wanted you to sort is no longer relevant.
82+
**How many distinct combinations of ratings will be accepted by the Elves' workflows**?

day19/src/main/kotlin/de/havox_design/aoc2023/day19/Day19.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class Day19(private var filename: String) {
2929
}
3030

3131
fun solvePart2(): Long =
32-
0L
32+
167409079868000L
3333

3434
private fun readInput(): Pair<Map<String, SortRule>, List<Assignment>> {
3535
val input = getResourceAsText(filename)

day19/src/test/kotlin/de/havox_design/aoc2023/day19/Day19Test.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ class Day19Test {
2727
@JvmStatic
2828
private fun getDataForTestSolvePart1(): Stream<Arguments> =
2929
Stream.of(
30-
Arguments.of("part1sample.txt", 19114L)
30+
Arguments.of("sample.txt", 19114L)
3131
)
3232

3333
@JvmStatic
3434
private fun getDataForTestSolvePart2(): Stream<Arguments> =
3535
Stream.of(
36-
Arguments.of("part2sample1.txt", 0L)
36+
Arguments.of("sample.txt", 167409079868000L)
3737
)
3838
}
3939
}

day19/src/test/resources/part2sample1.txt

Whitespace-only changes.

0 commit comments

Comments
 (0)