The Flip Game
BOI 99 Day 1 Problem 2The Flip GameThere is an ancient solitaire game named "the flip game". It consists of an array of M rows and 9 columns of two-colored pegs, with a black and a white side. When a peg with its white side showing is flipped, it shows its black side, and the other way around. In each move of the game the player flips an entire row or an entire column. The objective of the game is to leave as few pegs on their black side on the board as possible, by doing any number of moves. InputYour program should read the input from the file INPUT.TXT. The first line contains one positive integer number M (1 <= M <= 1000), denoting the number of rows in the game board. The next M consecutive lines contain exactly 9 characters, which are "0"s or "1"s, separated by one space character, where "0" means a peg showing its white side and "1" means a peg showing its black side.OutputYour program should produce its output into the file OUTPUT.TXT as follows:There will be only one line of text, containing the minimum possible number of pegs showing their black side, which are left on the game board. Sample Input4 1 1 1 1 1 1 1 1 1 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 Sample Output1 RemarkTime Limit per test: 3 secondsSubmitStatistics |