← All problemsSign in

Colouring graphs

In this problem you will be given a simple acyclic graph and asked to perform update or query operations on the graph. Update operations will involve adding an edge to the graph or removing one. You are assured that adding the given edges will not introduce cycles in the graph. Your task is to answer the queries which ask you to find the number of ways the graph can be coloured using K colours suc

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start