Repovive
  • Dashboard
  • Ranking
  • Submissions
  • Discussion
  1. Contests
  2. Starter Round 9
  3. 25G

My submissions

/
/
/
/

Announcements

My submissions

/
/
/
/

Announcements

Solve
Author

Follow each guest's destination

For every guest iii, draw an arrow from pip_ipi​ to qiq_iqi​. Also draw an arrow from the initially empty sofa to the desired empty sofa. Each sofa now has exactly one incoming and one outgoing arrow, so the sofas split into cycles.

The cycle containing the empty sofa can be solved by repeatedly moving the guest whose destination is currently empty. If it contains LLL sofas, this takes L−1L-1L−1 moves. Every guest moves directly to their destination, so all these moves are legal. Along the way, every sofa in this cycle becomes empty.

A different cycle of length L>1L>1L>1 needs at least L+1L+1L+1 moves. Every guest must move, and the first guest to leave the cycle cannot move directly to their destination: that sofa is still occupied. This guest must move at least twice.

A one-sofa cycle contains a guest who is already correctly seated. Leaving this guest alone costs nothing. Using their sofa temporarily costs at least two moves, since they must leave and return.