11396 - Sparse Matrix Convolution   

Description

Do image convolution by giving input matrix and filter matrix as sparse matries.

Input

The first number describes the amount of matrix convolution we want to compute.

Following by each image matrix’s #row, #col, #non-zeros and its non-zero terms' row, col, value. Also, the filter matrix's #row, #col, #non-zeros and its non-zero terms' row, col, value.

Output

Print out each output matrix’s #row, #col, #non-zeros and its non-zero terms' row, col, value.

Sample Input  Download

Sample Output  Download

Tags

HW2



Discuss