summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--13.py12
1 files 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]]]