diff options
author | dzwdz | 2022-12-13 14:33:55 +0100 |
---|---|---|
committer | dzwdz | 2022-12-13 14:33:55 +0100 |
commit | a8a2b4608a171fcb77623559ba946daeec2699d8 (patch) | |
tree | d8bd3f334e36cf40ecf7a763288ac7990473b1fe | |
parent | 0c77ec229fb715d91ad4b64fb37ff295542f6e93 (diff) |
day 13 part 2
-rw-r--r-- | 22.13/main.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/22.13/main.py b/22.13/main.py index 25b09a1..1abc9d1 100644 --- a/22.13/main.py +++ b/22.13/main.py @@ -1,5 +1,6 @@ import json import sys +from functools import cmp_to_key lines = [json.loads(s) for s in sys.stdin.readlines() if s.strip()] @@ -28,3 +29,8 @@ for i in range(0, len(lines), 2): if cmp(a,b) != 1: partOne += i//2+1 print(partOne) + +divs = [ [[2]], [[6]] ] +lines += divs +lines = sorted(lines, key=cmp_to_key(cmp)) +print((lines.index(divs[0]) + 1) * (lines.index(divs[1]) + 1)) |