Skip to content

Commit

Permalink
simplified
Browse files Browse the repository at this point in the history
  • Loading branch information
viliampucik committed Dec 13, 2022
1 parent 289388d commit 817469b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions 2022/05.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,15 @@ def solve(stacks, lines, step=1):


data, lines = open(0).read().split("\n\n")
# fmt:off
stacks = [
"".join(column).rstrip()
for i, column in enumerate(zip(*data.splitlines()[-2::-1]))
if i % 4 == 1
if i % 4 == 1
]
lines = [
(int(line[1]), int(line[3]) - 1, int(line[5]) - 1)
for line in map(str.split, lines.splitlines())
]
# fmt:on

print(solve(stacks.copy(), lines, -1))
print(solve(stacks.copy(), lines))

0 comments on commit 817469b

Please sign in to comment.