← All problemsSign in

Ash and PokemonGo

This time Ash is playing PokemonGo and wants to catch all pokemon in his city. Finally Ash got a PokeMap. This PokeMap contains an undirected graph containing N nodes and M edges. Each node denotes the location of a pokemon. Each edge Mi has an integer cost Ci associated with it. The cost of a path is the bitwise OR of every edge cost in the path between a pair of nodes, A and B . In other words,

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