diff options
-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]]] |