Hong Kong Olympiad in Informatics [HKOI] 2003

Practice Problem

The following problem is posted here for interested contestants to practise programming and to practise file input and output.

Problem: Light Out
Sample solution