AtCoder Grand Contest 035. B. Even Degrees

https://atcoder.jp/contests/agc035/tasks/agc035_b

We can restated the problem as follows. There are people on vertices with odd degree. When we swap the direction of the edge, the human on the end-points moves on the edge. If both endpoints have people, these two will disappear. We want to remove all the people.

f:id:pekempey:20190715031956p:plain:w350

f:id:pekempey:20190715032004p:plain:w350

f:id:pekempey:20190715032018p:plain:w350

It is easy to remove them. We just move all the people to one place. If there are the odd number of people, we cannot construct because one human remains.