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
2014-02-05 03:53:27 Piotr KÄ…kol
Yeah, but it's kind of unfair for other users who may have a valid solution which would be shorter then valid equivalent of the best current one. I know it's also unfair to change the problem now but I think it's a better solution. Apologies. I've already done this with other tasks so it should happen with this one as well.
2014-01-24 00:44:21 Mitch Schwartz
Eh, all of my submissions for this problem rely on some degree of input weakness, because of a precision issue for a special class of inputs for an isolated part of my code that is in every submission. On the one hand it's good to make the test data strong, but on the other hand it's annoying to deal with a moving target. It's like if there is a problem where using X digits of Pi can pass, but there's a missing case where X+1 digits would be required, and for every submission you used X digits...

Last edit: 2014-01-24 08:50:14
2014-01-18 17:27:41 Piotr KÄ…kol
Thanks for informing. Will fix it in Feb.
2014-01-18 14:25:58 Linghui Liu
there are some missing tests which my 75/76 awk code fails,e.g. 3 9.

Last edit: 2014-01-18 14:31:18
2010-05-22 11:30:51 Piotr KÄ…kol
Now there are only 25 tests.

Last edit: 2010-05-22 11:30:49
2010-05-21 19:36:26 Zoltán Zámbori
The Perl code which contains "use integer;" needs ~23sec, others get TLE :-(

+1 problem when the test data and/or the time limit is against "Shortening codes" :-(

Last edit: 2010-05-21 19:52:57
2010-05-20 23:35:56 Piotr KÄ…kol
When I changed time limit into 30sec only one of Your submissions get AC.
(what I may tell You is that there are exactly 100 tests ;-) )
2010-05-20 21:51:35 Zoltán Zámbori
Thank You! Running 100 times my code with these numbers needs 10.5 sec :-(
2010-05-18 18:22:03 Piotr KÄ…kol
In:
885387 1649760493
Out:
463003 443199

Maybe not the biggest but one of the biggest.

Last edit: 2010-05-22 11:36:02
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.