RECTANGLE - Honest Rectangle

Pat and Avery are secretive people. They're honest, but not too honest. They don't say more than they have to.

When they are together, their friend Kendall says she is thinking of a rectangle with integer dimensions w and h, such that L ≤ w ≤ h ≤ U. She says she will give Pat the perimeter and Avery the area. She then privately gives the perimeter to Pat and the area to Avery.

They then have the following honest conversation.

Avery: I don't know what w and h are.
Pat: I knew that.
Avery: Now I know what they are.
Pat: I now know too.

In additional to being honest, both Pat and Avery are very smart. They use all the information they have available.

What are the possible values for w and h?

Input Format

Input is two lines. The first line is the integer L, and the second line is the integer U.

Constraints Format

1 ≤ L ≤ U ≤ 1000

Output Format

Ouput the possible values for w and h. Use one line for each pair, and separate the numbers in pair by a single space.

Sort by w and then by h.

It may be that there are no possibilties. (In that case, Kendall must've made a mistake.)

Sample

Input:
1
15

Output:
1 4
3 4
Input:
2
865

Output:
4 13

Added by:SKT T1 Faker
Date:2019-09-17
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All
Resource:2018 Lucid Programming Competition

hide comments
2020-05-15 09:22:24 mehmetin
In problem PLATON's sample data, there are no pairs for input (1 10).
However, here for input (1 15), (3 4) is an output.
Shouldn't (3 4) be an output for PLATON's first sample case?

2019-11-29 13:43:14 :D
The answer questions below: It's hard to explain why certain rectangle is not a solution without describing the entire programs algorithm. The question is not incomplete and the description states that there can be multiple answers. No answers is also possible.

The PLATON problem is almost the same. The value ranges differ somewhat (I described that in the comment on PLATON page). The interesting potential difference is that in this problem the second sentence is "I knew that." and not "I knew that. I don't know either." I actually made some tests and could not find an L, U pair where that would make a difference. Maybe it can be formally proven that it never does.
2019-10-11 15:17:50 Simes
Same as PLATON
2019-09-20 15:20:20
it looks an incomplete question to me as lots of possible rectangle are possible
2019-09-19 14:14:47 Sushovan Sen
Why (2,9) cannot be a solution for second case? Can someone please explain.

Last edit: 2019-09-19 14:15:44
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.