• + 0 comments

    the problem is resolution

    using System; using System.Collections.Generic; using System.IO; using System.Linq;

    class Solution { static void Main(string[] args) { // Read the input string[] input = Console.ReadLine().Split(' '); int n = int.Parse(input[0]); int m = int.Parse(input[1]);

        int[] firstRow = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
    
        // Call the method to compute the last row
        int[] lastRow = XorMatrix(n, m, firstRow);
    
        // Print the result
        Console.WriteLine(string.Join(" ", lastRow));
    }
    
    static int[] XorMatrix(int n, int m, int[] firstRow)
    {
        int[] previousRow = firstRow;
        int[] currentRow = new int[n];
    
        // Generate each row from the second to the last row
        for (int i = 1; i < m; i++)
        {
            for (int j = 0; j < n; j++)
            {
                currentRow[j] = previousRow[j] ^ previousRow[(j + 1) % n];
            }
    
            // Update the previous row to the current row for the next iteration
            previousRow = (int[])currentRow.Clone();
        }
    
        // The last generated row is stored in previousRow
        return previousRow;
    }
    

    }