← All problemsSign in

MaxEdges

CodeChefRating 1618Open on judge ↗

Tracy gives Charlie a [Directed Acyclic Graph](https://en.wikipedia.org/wiki/Directed_acyclic_graph) with $N$ vertices. Among these $N$ vertices, $K$ vertices are *sources*, and $L$ vertices are *sinks*. Find out the **maximum** number of edges this graph can have. Note: - A *source* is a vertex with **no incoming** edge. - A *sink* is a vertex with **no outgoing** edge. - A vertex can be **bot

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