please solve this lonely problem :(

Revision en1, by bobbilyking, 2025-04-19 21:14:07

You are given a connected undirected graph with $$$n$$$ nodes and $$$m$$$ edges. Each node $$$u$$$ has an ordered list $$$l_u$$$ of its neighbors, and an arrow pointing to one of its neighbors $$$p_u$$$. Initially, $$$p_u$$$ is the first neighbor in $$$l_u$$$.

You start at node $$$s$$$, and repeat the following process infinitely many times:

  • Let $$$v$$$ be the node at which you are currently located. Move from $$$v$$$ to $$$p_v$$$.
  • Increment $$$p_v$$$ to the next neighbor in $$$l_v$$$ cyclically.

Consider the list $$$p_1, p_2, \cdots p_n$$$ over the course of this process, as well as the current node $$$c$$$. We call this a state.

Print any state that appears an infinite amount of times.

$$$n, m \leq 10^5$$$

Link to Problem


it's just sitting there, all alone, it needs a hug :(


some more great problems from the Rutgers Programming Contests

Hungry Arachnid

Domino Swap

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English bobbilyking 2025-04-19 21:14:07 1042 Initial revision (published)