Rainbow Graph
CodeChefOpen on judge ↗
You are given an undirected compete graph with n nodes. Each edge can be one of n*(n-1)/2 +1 different colors. These colors are labeled from 0 to n*(n-1)/2, inclusive. But not all these n*(n-1)/2 +1 colors need to be used. ie. it is possible that two different edges could have the same color. Formally, let ci,j denote the color between the i-th and j-th nodes. (Note that these edges are undirected
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start