Problem hidden
This problem was hidden by Editorial Board member probably because it has incorrect language version or invalid test data, or description of the problem is not clear.

SHIFT - Shift

You are given matrix z (n x m) and two integers x and y.

The value of x represents the displacement of matrix z in the horizontal direction (positive value is offset to the right, negative to left), and the value of y represents the shift of matrix z in the vertical direction (positive value upward, negative downward).


Input consist of unknown number of test cases.

Each of them contain integers n and m (n,m<111). Then, in each of n lines are m numbers. Finally, at the end of each test appear x and y (-1000<x,y<1000).

Input ends when n=m=0.


Matrix after shift (as in the example - with blank line at the end of each test).


3 3
1 2 3
4 5 6
7 8 9
2 -1
3 4
6 7 8 5
10 11 12 9
2 3 4 1
-3 2
0 0
8 9 7
2 3 1
5 6 4

1 2 3 4
5 6 7 8
9 10 11 12

Added by:Piotr Kąkol
Time limit:14.92s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC SCM qobi VB.NET
Resource:Brazilian Olympiad in Informatics

hide comments
2014-06-04 15:16:41 Dominique VAILLANT
@Mitch: Another fabulous score! You are promoting Ruby as a star language on SPOJ SHORTEN. Furthermore it's not an easy job to beat Jander/Perl!
2010-07-14 15:34:26 Piotr KÄ…kol
I knew I forgot about something. ;-)
One more time sorry for my mistake.
2010-07-14 12:40:55 HWK
Is there something wrong with the data? Python-solutions from three persons give NZEC. At home my code runs without problems? I suppose the code from the others does it too.

Edit: The last line seems to be the problem. Is it really "0 0"?

Last edit: 2010-07-14 14:51:09
2010-07-13 18:53:11 Piotr KÄ…kol
If the explanation of the task isn't clear enought write here Your questions.
© All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.