← All problemsSign in

Visiting Friends

Fluffy the squirrel lives in a big city, which contains n towns. There are m uni-directional roads in the city. ci people live in town i. For each town i, Fluffy starts at town i, and keeps moving to other towns using the uni-directional roads, for as long as he wants. Fluffy would like to maximize the number of distinct people he visits along the way. (including the inhabitants of town i) He woul

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