aoc2022/d18/part1.py

15 lines
280 B
Python

import sys
S = set()
for l in sys.stdin.read().splitlines():
S.add(tuple(map(int,l.split(','))))
N = 0
for (x,y,z) in S:
n = 6
for (i,j,k) in [(0,0,1),(0,0,-1),(0,1,0),(0,-1,0),(1,0,0),(-1,0,0)]:
if (x+i,y+j,z+k) in S:
n -= 1
N += n
print(N)