Heaviest CC
CodeChefOpen on judge ↗
A simple undirected and unweighted graph with no self loops and parallel edges will be given, containing $n$ nodes and $m$ edges. Each of the nodes has a distinct index between $1$ and $n$. The number of connected components in the graph is $K$. $a_1, a_2, ..., a_k$ are $K$ numbers, where $a_i$ is the weight of the $i^{th}$ component of the graph (weight of a component is the sum of values of nod
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