private static void InitialiseEmptyMatrix(cell[,] matrix) { int rows = matrix.GetLength(0); int cols = matrix.GetLength(1); for (int i = 0; i < rows; i++) { for (int j = 0; j < cols; j++) { matrix[i, j] = new cell(); } } }
static void Main() { long[] num = Console.ReadLine().Split().Select(long.Parse).ToArray(); long rows = num[0]; long cols = num[1]; cell[,] matrix = new cell[rows, cols]; InitialiseEmptyMatrix(matrix); ReadInputMatrix(matrix); CountUp(matrix); CountLeft(matrix); CountRight(matrix); CountDown(matrix); List <Frame> frames = new List <Frame>(); var bestCandidates = OrderByBestCandidates(matrix).ToList(); FindLargestFrame(matrix, bestCandidates, frames); ShowResult(frames); }