Reverse Averaging
Very hard
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
One of the common tasks in image processing is averaging. Consider a set of numbers (u_i,j) representing image brightness, where (i, j = 0, 1, ..., n-1). Averaging involves calculating the values:
[ v_i,j = 5u_i,j + u_i-1,j + u_i,j-1 + u_i,j+1 + u_i+1,j ]
The indices are taken modulo (n). Given a set of numbers (v_i,j), your task is to restore the original values (u_i,j).
Input
The first line contains the integer (2 n 100). The following (n) lines each contain (n) integers, where (-10 v_i,j 10).
Output
Output (n) lines, each containing (n) numbers, representing the restored set (u_i,j). The numbers should be output with a precision of at least (10^-9).
Examples
Input #1
Answer #1
Submissions 10