RECTANGLE - Honest Rectangle

no tags 

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.



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 0


Sample Output 0

1 4
3 4

Sample Input 1


Sample Output 1

4 13

hide comments
mehmetin: 2020-05-15 09:22:24

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?

:D: 2019-11-29 13:43:14

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.

Simes: 2019-10-11 15:17:50

Same as PLATON

rishk3: 2019-09-20 15:20:20

it looks an incomplete question to me as lots of possible rectangle are possible

Sushovan Sen: 2019-09-19 14:14:47

Why (2,9) cannot be a solution for second case? Can someone please explain.

Last edit: 2019-09-19 14:15:44

Added by:SKT T1 Faker
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Resource:2018 Lucid Programming Competition