← All problemsSign in

Konigsberg Bridge

There are N islands numbered from 0 to N-1 which are connected by a single bridge. Peter and Pan are located at island 0. They want to visit all islands exactly once and return back to island 0. There are K toll booths. Each toll booth has a certain range of functioning. The arguments for toll k are given as x_k and y_k. If the salesman travels from city i to j, he has to pay 1 dollar toll fee to

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