There are $n$ sheep and a wolf in sheep's clothing . Some of the sheep are friends (friendship is mutual). The goal of the wolf is to eat all the sheep. First, the wolf chooses some sheep to make friend's with. In each of the following days, the wolf eats one of its friends. Whenever the wolf eats a sheep $A$: (a) If a friend of $A$ is originally a friend of the wolf, it un-friends the wolf. (b) If a friend of $A$ is originally not a friend of the wolf, it becomes a friend of the wolf. Repeat the procedure until the wolf has no friend left. Find the largest integer $m$ in terms of $n$ satisfying the following: There exists an initial friendsheep structure such that the wolf has $m$ different ways of choosing initial sheep to become friends, so that the wolf has a way to eat all of the sheep.
Problem
Source: Taiwan TST 2018
Tags: combinatorics, graph theory, Processes, algorithm
GammaBetaAlpha
28.02.2019 06:31
Bumpy bump
HelenZhang2006
28.02.2019 06:39
Friendsheep? That a pun?
p_square
28.02.2019 07:03
Yes; That wasn't there in original problem.
Pluto1708
10.03.2019 09:53
\bumpity bump
Math1Zzang
10.03.2019 14:46
We claim that the largest $m$ is $2^{n-1}$.
Think of the problem as a graph, where each sheep is a vertex and edges mean friendship.
For each vertex, denote the state as $1$ if the sheep is friends with the wolf and $0$ otherwise.
Now for each move, the wolf can remove one of the vertices with state $1$, and change the states of the neighbors of the removed vertex.
Example such that $m=2^{n-1}$.
Let the initial friendship structure be the star graph with $n$ vertices. Denote the internal vertex as $v$.
If there are odd number of vertices with state $1$, then the wolf removes all the leafs with state $1$, and then removes $v$.
(Removing $v$ is possible because there were odd number of vertices with state $1$ initially)
Now the wolf can remove all the remaining vertices, since they all have state $1$.
The number of ways of initial states such that there are odd number of vertices with state $1$ is $2^{n-1}$.
Proof for $m\leq 2^{n-1}$
Denote the number of vertices with state $1$ as $R$.
We will prove that if the wolf can remove all the vertices, then intially the condition $R\equiv n+\left|E(G)\right| (mod 2)$ holds.
Consider the invariant $S=R+\left|V\right|+\left|E\right|$.
$\left|V\right|$ and $\left|E\right|$ respectively means the number of vertices and edges left.
Now after each move, the parity of $S$ does not change, and at the end, $S=0$.
So intially $S$ should be even, and we're done.
SnowPanda
22.12.2020 23:55
The answer is $2^{n - 1}$.
First, we claim that when the sheep form a path, the wolf can win by choosing any odd-sized subset of the sheep to make friends with. This is true for $n = 1$, so now we can use strong induction on $n$. The wolf eats the topmost sheep it is friends with. If this sheep is at the top of the path, then the sheep structure becomes a path of length $n - 1$, and the wolf still has odd degree, so the wolf wins by the inductive hypothesis. Meanwhile, if the sheep isn't at the top of the path, then the structure splits into two paths, the first with degree $1$ and the second with odd degree. So again the wolf wins by the inductive hypothesis.
Now if the wolf has degree $w$, and there are $n$ sheep with $e$ edges between them, we claim $w \equiv e + n \pmod{2}$. Clearly this is true for $n= 1$. Now note that $w + e + n$ is fixed mod $2$ -- if the wolf eats a sheep with degree $d$, then $w$ changes by $1 + d$ mod $2$, $e$ decreases by $d$, and $n$ decreases by $1$. So this means it must always be $0$ mod $2$. So then the parity of the wolf's number of friends is fixed, which means it has at most $2^{n - 1}$ choices.
MotivationBy doing small cases, we can notice that the wolf's parity is fixed, and that it's always odd on trees and even on cycles, which suggests that the parity is related to some combination of $n$ and $e$. The construction comes from taking a fairly simple tree to have more control (we want the graph to be connected because otherwise we get a parity constraint on each connected component, which reduces the number of ways).