From dc76b554508cb7f4b1f1cd221192b505e7a69211 Mon Sep 17 00:00:00 2001 From: Tomasz Kramkowski Date: Tue, 13 Dec 2022 10:42:06 +0000 Subject: 13 folded --- 13.py | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/13.py b/13.py index c836bd0..01f8063 100644 --- a/13.py +++ b/13.py @@ -12,18 +12,14 @@ def compare(l, r): cmp = compare(a, b) if cmp != 0: return cmp return compare(len(l), len(r)) - case ([*l], int(r)): - return compare(l, [r]) - case (int(l), [*r]): - return compare([l], r) - case (int(l), int(r)): - return min(max(l - r, -1), 1) + case ([*l], int(r)): return compare(l, [r]) + case (int(l), [*r]): return compare([l], r) + case (int(l), int(r)): return min(max(l - r, -1), 1) p1 = 0 for i, (l, r) in enumerate(pairs): cmp = compare(l, r) - if cmp < 0: - p1 += i + 1 + if cmp < 0: p1 += i + 1 print(p1) p2 = [[[2]],[[6]]] -- cgit v1.2.3-54-g00ecf