Skip to content

Commit d88c70a

Browse files
committed
c
1 parent 1385ed0 commit d88c70a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

2025/Day07/Solution.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@ namespace AdventOfCode.Y2025.Day07;
66
class Solution : Solver {
77

88
public object PartOne(string input) => RunManifold(input).splits;
9+
910
public object PartTwo(string input) => RunManifold(input).timelines;
11+
1012
public (int splits, long timelines) RunManifold(string input) {
1113
// Dynamic programming over the grid:
1214
//
@@ -20,18 +22,18 @@ class Solution : Solver {
2022
var lines = input.Split("\n").Select(line => line.ToCharArray()).ToArray();
2123
var crow = lines.Length;
2224
var ccol = lines[0].Length;
23-
2425
var splits = 0;
2526
var timelines = new long[ccol];
27+
2628
for (int irow = 0; irow < crow; irow++) {
2729
var nextTimelines = new long[ccol];
2830
for (var icol = 0; icol < ccol; icol++) {
29-
if (lines[irow][icol] == '^') {
31+
if (lines[irow][icol] == 'S') {
32+
nextTimelines[icol] = 1;
33+
} else if (lines[irow][icol] == '^') {
3034
splits += timelines[icol] > 0 ? 1 : 0;
3135
nextTimelines[icol - 1] += timelines[icol];
3236
nextTimelines[icol + 1] += timelines[icol];
33-
} else if (lines[irow][icol] == 'S') {
34-
nextTimelines[icol] = 1;
3537
} else {
3638
nextTimelines[icol] += timelines[icol];
3739
}

0 commit comments

Comments
 (0)