E - Not Dyed by Majority (Cubic Graph) Editorial by i_am_noob

Practical Proof During Contest

If you think the official editorial is crazy, this editorial is for you.

Notice that there are \(2^N\) initial sequences and also \(2^N\) final sequences, so it is clear that the answer always exists.

Let \(u_1,u_2,u_3\) be the neighbors of vertex \(1\).

Let \(1,v_{i1},v_{i2}\) be the neighbors of \(u_i\) for \(i=1,2,3\).

Consider an initial sequence \(s\). If \(s_{v_{i1}}=s_{v_{i2}}\) for \(i=1,2,3\), flipping \(s_1\) results the same final sequence. By case analysis, there are at least \(2^{N-3}\) sequences which satisfies this, therefore there are at least \(2^{N-4}\) final sequences which can be the answer.

At this point, you should believe that random selection won’t get TLE and write the solution.

posted:
last update: