z-photo
Little Z has taken two pictures of the sky. since it was dark, the image was really noisy.
However, Little Z hands are a little bit shaky so his second image was a little bit shifted relative to the first one. It is shifted by some number of columns and some number of rows.
Your job is to find out how much is the second image shifted in both x and y direction (columns and rows). The image will always be shifted by non-negative amount of rows and columns, and will have at least one pixel overlap with the original image.
You can assume that the elements (pixels) of the image are mostly random (because of the noise). The image below is just an example of the images little Z would take if he was taking images of Lena (and not the sky)
Important: the shift will always be non-negative: 0 or more rows and 0 or more columns.
Important: if the second image can be shifted in different ways so that it still represents the same image, then output the sift with the smallest shift in columns, and if there are more of those then output the smallest shift in rows
4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
3 4 5 0
4 5 6 7
5 6 7 8
0 7 8 9Output:
1 14
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
2 3 4 5
3 4 5 6
4 5 6 7
5 6 7 8Output:
0 1Explanation: the second image can be shifted by (1, 0) or (0, 1) and still represent the same object, we output (0, 1) since that is the sift with smaller column shift
4
1 2 3 4
2 3 4 5
3 4 5 6
4 5 6 7
2 3 4 1
3 4 5 6
4 5 6 7
5 6 7 8Output:
1 0Submit solution
Coming laterThe grading service will be connected in a later migration step. You can inspect the task and your previous results now.