From 94d0033ed89bb5bfb6500051296892fb7cea6c29 Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Mon, 25 Dec 2023 17:56:34 +0100 Subject: Small cleanup --- 2023/18/18b.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to '2023/18') diff --git a/2023/18/18b.c b/2023/18/18b.c index d79d4cb..7b16309 100644 --- a/2023/18/18b.c +++ b/2023/18/18b.c @@ -1,6 +1,7 @@ /* -I have lost my code for part one. It reused some stuff from day 10. -This code can be adjusted to work for part one, just change the input reading. +I have lost my code for part one. It reused some stuff from day +10. This code can be adjusted to work for part one, just change the +input reading part. */ #include @@ -57,10 +58,6 @@ int64_t overlaplen(int64_t a[], int64_t na, int64_t b[], int64_t nb) { return ret; } -int64_t linelen(int64_t a[], int64_t n) { - return overlaplen(a, n, a, n); -} - int main() { p[n++] = (point_t) {0}; while ((buf = fgets(in, 50, stdin)) != NULL) { @@ -80,7 +77,7 @@ int main() { if (p[i].i != p[i+1].i) { qsort(a, ia, sizeof(int64_t), &cmp_int64); ia = removedoubles(a, ia); - t += linelen(a, ia) * (p[i+1].i - p[i].i + 1) - + t += overlaplen(a, ia, a, ia)*(p[i+1].i - p[i].i + 1) - overlaplen(a, ia, olda, nolda); nolda = ia; memcpy(olda, a, nolda * sizeof(int64_t)); -- cgit v1.3