Graph Theory37 sections · 1633 units
Open in Course

CSES 1668 Building Teams - Problem Statement

CSES

In a school, there are nn pupils and mm friendships.

Your task is to divide the pupils into two teams so that no friends are in the same team. If possible, print the team number (11 or 22) for each pupil. If impossible, print "IMPOSSIBLE". This is the same bipartite detection, but now you must output the actual partition, not yes/no. Before reading on, think: how do you produce the output?

What do the colors represent?