GRIDPNT - Grid points
There's a Cartesian lattice with 0<=x,y<=n. Given one point (x1, y1>0) in this lattice rotating clockwise as little as possible around the origin find the next point (x2, y2). The given and searched points mustn't have another point between the origin (0, 0) and this point itself.
x1, y1, x2, y2 are non-negative integers.
Score is source length.
Input
In the first line the number T (T<100) of test cases.
Then T lines with the space-separated n (1<=n<=50), x1 and y1.
Output
For each test case the space-separated x2 and y2.
Example
Input: 3
1 1 1
5 3 2
50 48 49 Output: 1 0
5 3
49 50
hide comments
coding_express:
2013-06-25 06:13:18
i have posted my code in forum as wa in gridpnt,please check and reply |
|
coding_express:
2013-06-25 06:02:22
tricky test cases please |
|
Aditya Pande:
2012-11-23 08:24:40
should o(n) solution work for the speed variation of this problem
|
|
Mitch Schwartz:
2012-11-16 12:05:22
@Aditya: Yes, the input is well formatted, else my AWK solution couldn't pass. |
|
Aditya Pande:
2012-11-16 06:57:33
@mitch can u confirm that is the each input test case is on one line or not?
|
|
Mitch Schwartz:
2012-11-09 03:04:47
"(x1, y1>0)" is confusing, since the intention is "(x1>=0, y1>0)". |
|
Aditya Pande:
2012-08-07 19:43:55
my AWK submission is getting NZEC
|
|
Aditya Pande:
2012-08-07 19:43:55
Last edit: 2012-11-16 08:20:14 |
|
HWK:
2012-08-07 19:43:55
@Johan de Ruiter: You could reach at least 133 bytes. ;-)
|
|
HWK:
2012-08-07 19:43:55
@XeRon!X: With a new algo reached 94 bytes. ;-) Last edit: 2011-06-27 12:13:04 |
Added by: | HWK |
Date: | 2011-05-24 |
Time limit: | 9.989s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All |