PAST3E
from Third Algorithm Practical Skills Test
PAST3E
E Problem of coloring a graph. Write in a simple and concise manner so as not to include bugs.
code:python
from collections import defaultdict
N, NUM_EDGES, Q = int(x) for x in input().split()
edges = defaultdict(list)
for i in range(NUM_EDGES):
v1, v2 = int(x) for x in input().split()
edgesv1.append(v2)
edgesv2.append(v1)
colors = int(x) for x in input().split()
for i in range(Q):
# print(colors)
f, *v = int(x) for x in input().split()
# print(f, v)
if f == 1:
n, = v
c = colorsn - 1
print(c)
# sprincle
# print(edges)
for v in edgesn:
colorsv - 1 = c
elif f == 2:
n, c = v
print(colorsn - 1)
colorsn - 1 = c
---
This page is auto-translated from /nishio/PAST3E using DeepL. If you looks something interesting but the auto-translated English is not good enough to understand it, feel free to let me know at @nishio_en. I'm very happy to spread my thought to non-Japanese readers.