Skip to content

Instantly share code, notes, and snippets.

@kaathewise
Last active December 20, 2021 12:52
Show Gist options
  • Save kaathewise/0fe1bd67f3d693718dabd73f9900ba47 to your computer and use it in GitHub Desktop.
Save kaathewise/0fe1bd67f3d693718dabd73f9900ba47 to your computer and use it in GitHub Desktop.
from functools import reduce
print([*[reduce(lambda m,_: ({v:a[0][int(''.join("01"[m[0].get(v+d,m[1])=='#'] for d in D),2)] for v in {v-d for v in m[0] for d in D}},a[0][511*(m[1]=='#')]),range(50),(a[2],'.')) for D in [[k//3+k%3*1j for k in range(9)]] for f in [open(0)] for a in [(next(f),next(f),{x+y*1j:c for x,s in enumerate(f) for y,c in enumerate(s)})]][0][0].values()].count('#'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment