diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2022-12-13 10:42:06 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2022-12-13 10:42:06 +0000 |
commit | dc76b554508cb7f4b1f1cd221192b505e7a69211 (patch) | |
tree | fd09e1f46d026d69a5951f132f2792ecb9f60238 | |
parent | ed25f645184821945d1c55e15cff8c93612f330f (diff) | |
download | aoc2022-dc76b554508cb7f4b1f1cd221192b505e7a69211.tar.gz aoc2022-dc76b554508cb7f4b1f1cd221192b505e7a69211.tar.xz aoc2022-dc76b554508cb7f4b1f1cd221192b505e7a69211.zip |
13 folded
-rw-r--r-- | 13.py | 12 |
1 files changed, 4 insertions, 8 deletions
@@ -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]]] |