← All problemsSign in

Graph Monsters

CodeChefRating 3112Open on judge ↗

You are given a connected, undirected graph consisting of $N$ nodes and $M$ edges. Every node has a pass value of $A_i$ and a monster with health $B_i$. Your task is to defeat all the monsters eventually. To do that, you can do the following steps: - Choose a starting node $S$ ($1 \le S \le N$) and a starting health value $H$. - Suppose your current node is $X$, you can either battle the monster

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