summary refs log tree commit diff homepage
path: root/2018
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-12-04 21:11:06 -0500
committerJune McEnroe <june@causal.agency>2018-12-04 21:11:06 -0500
commitfafa0b777ea80b4400c8ad3470b991df92dbc8eb (patch)
tree47873863461b7ae54574ac0b6e8d149cca29a451 /2018
parentSolve day 4 part 1 (diff)
downloadaoc-fafa0b777ea80b4400c8ad3470b991df92dbc8eb.tar.gz
aoc-fafa0b777ea80b4400c8ad3470b991df92dbc8eb.zip
Solve day 4 part 2
Diffstat (limited to '2018')
-rw-r--r--2018/day04.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/2018/day04.c b/2018/day04.c
index 5d2939f..78506ab 100644
--- a/2018/day04.c
+++ b/2018/day04.c
@@ -42,4 +42,14 @@ int main() {
 		maxMin = m;
 	}
 	printf("%u\n", maxID * maxMin);
+	maxID = maxMin = maxSleep = 0;
+	for (uint i = 0; i < Len; ++i) {
+		for (uint m = 0; m < 60; ++m) {
+			if (guards[i][m] < maxSleep) continue;
+			maxSleep = guards[i][m];
+			maxMin = m;
+			maxID = i;
+		}
+	}
+	printf("%u\n", maxID * maxMin);
 }