diff options
| author | mhsn <mail@mhsn.net> | 2026-03-18 21:48:13 +0000 |
|---|---|---|
| committer | mhsn <mail@mhsn.net> | 2026-03-18 21:48:13 +0000 |
| commit | 86bac31392a76da84817eec020d2b84d099b3cc1 (patch) | |
| tree | e2ee52db59b86b914d5b4bcceb19c9b5d899fff4 /2025/08 | |
| parent | 62fe361fc42dea75deaf7ac31c0ba6ba80e26a9c (diff) | |
| download | puzzles-86bac31392a76da84817eec020d2b84d099b3cc1.tar.gz puzzles-86bac31392a76da84817eec020d2b84d099b3cc1.zip | |
Diffstat (limited to '2025/08')
| -rwxr-xr-x | 2025/08/python.py | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/2025/08/python.py b/2025/08/python.py deleted file mode 100755 index 98a4725..0000000 --- a/2025/08/python.py +++ /dev/null @@ -1,29 +0,0 @@ -#!/usr/bin/env python3 - -from fileinput import input -from math import dist, prod -from operator import itemgetter - -MAX_CONNS = 1000 # test: 10, input: 1000 - -boxes = [[*map(int, line.split(","))] for line in input()] -N = len(boxes) - -js = {n: {n} for n in range(N)} -conns = sorted( - ((x, y) for x in range(N) for y in range(x)), - key=lambda t: dist(*itemgetter(*t)(boxes)), -) - -for n, (x, y) in enumerate(conns): - if n == MAX_CONNS: - lens = {id(j): len(j) for j in js.values()}.values() - print("silver:", prod(sorted(lens, reverse=True)[:3])) - - j = js[x] | js[y] - for b in j: - js[b] = j - - if len(j) == N: - print("gold:", boxes[x][0] * boxes[y][0]) - break |
