diff options
author | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-12-02 11:22:43 +0000 |
---|---|---|
committer | Tomasz Kramkowski <tomasz@kramkow.ski> | 2023-12-02 11:22:43 +0000 |
commit | 86eea5204564fb161faa96fcdd9580d7bd6e0d47 (patch) | |
tree | 1c0a9e73d6f3bc07fa849fc5e7d5356d0c5705e2 | |
parent | 015d98ddddd200b2ff28a8d6fb0f06cf282c050e (diff) | |
download | aoc2023-86eea5204564fb161faa96fcdd9580d7bd6e0d47.tar.gz aoc2023-86eea5204564fb161faa96fcdd9580d7bd6e0d47.tar.xz aoc2023-86eea5204564fb161faa96fcdd9580d7bd6e0d47.zip |
use operator
-rw-r--r-- | 2.py | 3 |
1 files changed, 2 insertions, 1 deletions
@@ -2,6 +2,7 @@ from sys import stdin from dataclasses import dataclass from functools import reduce from typing import TypeAlias +from operator import mul CubeSet: TypeAlias = dict[str, int] @@ -28,5 +29,5 @@ limits = {"red": 12, "green": 13, "blue": 14} # fmt: off print(sum(g.id for g in games if all(s[k] <= limits[k] for s in g.subsets for k in limits.keys() if k in s))) -print(sum(reduce(int.__mul__, (max(s[k] for s in g.subsets if k in s) for k in limits.keys())) for g in games)) +print(sum(reduce(mul, (max(s[k] for s in g.subsets if k in s) for k in limits.keys())) for g in games)) # fmt: on |