Editorial for IOI '12 P2 - Parachute Rings


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

A suboptimal solution covering all but the last subtask considers the following conditions:

  • if there is a vertex V of degree \ge 4, no other vertex can be critical (because removing V still leaves one or more vertices of degree \ge 3); so if there is more than one vertex of degree \ge 4, there are no critical vertices;
  • if there is a vertex V of degree 3, each critical vertex is either V or one of its neighbors;
  • if there is a cycle, all critical vertices lie on the cycle;
  • if the graph is linear (a set of disjoint paths), all of its vertices are critical.

These checks can be easily extended to the dynamic case of the last subtask: the only nontrivial check is keeping track of cycle formation, which can be dealt with using suitable data structures (union-find d.s., etc.).


Comments

There are no comments at the moment.