Easter Eggs Advanced

Problem #222

Tags: mathematics puzzle modulo c-1 c-0

Who solved this?

No translations... yet
  A9 B9 C9 D9 .. J9
  .. .. .. .. .. ..
  A3 B3 C3 D3 .. J3
  A2 B2 C2 D2 .. J2
  A1 B1 C1 D1 .. J1
  A0 B0 C0 D0 .. J0
  
temporary explanation of numbering eggs until we have interactive demo here

Brother Joe investigated solutions submitted for the Easter Eggs problem and have become sad, noticing they mainly rely on brute-force approach!

By lucky chance he mentioned this last Sunday to Old Good Mrs Harris, who runs poultry farm nearby. She hinted that brute-force time complexity for this task may be as bad as "exponential" (multiplied by certain value with every new egg).

So she supplied Brother Joe with a hundred eggs and now he gladly presents "advanced" version of the same challenge!

Problem statement

To conveniently arrange eggs they are placed into 10x10 grid and identified in chess-like manner with letter A..J denoting column and digit 0..9 denoting row.

All eggs are magical, as previously, so that any of them is touched, it changes color (red to white and next time white to red again) - and "switches" several other eggs in the same manner (always same).

We are told which eggs are initially red - and "rules of switching". We want to tell, as result, how to turn all eggs white.

Input data:
First line gives eggs which are red in initial setup.
Next lines give "toggling rules" - first of every line is the egg being touched, remaining are eggs which are toggled by it (don't forget every egg turns itself too).

Output data should tell coordinates of eggs to be touched in order to turn everything white.

Example below uses smaller grid, 5x5 for convenience.

A0 C0 A1 C1 D1 E1 C3 D3 C4 E4
A0 B0 A2 B1
B0 B4 C1 B2
C0 C2 B4
D0 D1 C0
E0 A2 E1 C0 E2 A0
A1 A0 A3
B1 E0 B2 B4 C1 A0
C1 B2 C2 D0 B1 A1
D1 A2 B1 C2 E2 D0
E1 E0 C1
A2 E2 A3
B2 C1 B1 C2 B3 A3
C2 C3 B2 D2 C4
D2 E1 D0 D4 D3
E2 C2 D3
A3 A2 B4
B3 B2 A3 A2 C4
C3 D2 A3 B2 B4
D3 C2 E2
E3 D2 A0 B4 A4
A4 C4 B3 B0 A0
B4 A3 C0
C4 E4 C2 B3 D4
D4 D3 A0
E4 D3 A0 D4 E3 E0

Possible solution is A1 D2 D1 C4 C3 A2 C0 B2.

Here the first line tells that 10 eggs are initially red. Next line states that touching A0 toggles four eggs (A0 B0 A2 B1) including itself. Third line is about touching A1 and so on, ending with the line describing effect of touching E4 (toggling six E4 D3 A0 D4 E3 E0).

You need to login to get test data and submit solution.