Created
December 6, 2020 06:45
-
-
Save kung-foo/c6a37b0e9d5a1c564c559d49ec1e631b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import os | |
import sys | |
import random | |
src = open("input.txt", "r").readlines() | |
src = [r.strip() for r in src] | |
print(len(src)) | |
groups = [] | |
group = [] | |
groups.append(group) | |
for row in src: | |
if row == "": | |
group = [] | |
groups.append(group) | |
continue | |
group.append(row) | |
p1 = 0 | |
p2 = 0 | |
for g in groups: | |
a = set() | |
f = [set(x) for x in g] | |
p1 += len(set.union(*f)) | |
p2 += len(set.intersection(*f)) | |
print(p1) | |
print(p2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment