18 lines
340 B
Python
Executable File
18 lines
340 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import networkx as nx
|
|
import matplotlib.pyplot as plt
|
|
|
|
from useful import *
|
|
|
|
g = nx.Graph()
|
|
for line in lines(open(0)):
|
|
ic(line)
|
|
l, r = line.split(': ')
|
|
for rr in r.split():
|
|
g.add_edge(l, rr)
|
|
print(np.prod([len(l) for l in nx.connected_components(g)]))
|
|
|
|
#nx.draw(g, with_labels=True)
|
|
#plt.show()
|