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.

SPIRAL - Spiral

Input

There is unknown number of tests. Each of them consists of one line in which appear two integers: n (0<n<=106; n always odd) - size of the square matrix and m (0<m<=n2) - the number of the choosen cell.

Output

For each test print index of the row and index of the column of the choosen cell which is determined by m.

Example

Input:
7 28
5 13
1 1
5 1
5 5
3 9
Output:
7 4
5 1
1 1
3 3
2 2
3 3


Added by:Piotr Kąkol
Date:2010-05-10
Time limit:1.659s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: NODEJS OBJC SCM qobi VB.NET
Resource:Author of the problem: David Déharbe;
Author of the illustration: Wanderley Guimarães

hide comments
2010-05-17 07:40:18 Zoltán Zámbori
Piotr, can you copy the largest numbers (n,m,row,column) from the tests?
2010-05-15 18:00:39 Piotr KÄ…kol
Perl shouldn't be so slow if Your program in C has 0.14. It might be caused by: 0
2010-05-14 22:40:23 Zoltán Zámbori
I rewrote my C code into Perl (#3627710). C needs 0.09 sec to finish, but the Perl code run >10 sec (TLE). It is my fault, or Perl is really so slow?

Last edit: 2010-05-14 22:51:48
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.