KTH Challenge 2015 Warm-up


2015-04-21 23:00 CEST

KTH Challenge 2015 Warm-up


2015-04-26 11:00 CEST
The end is near!
Contest is over.
Not yet started.
Contest is starting in -882 days 14:03:26

Time elapsed


Time remaining


Problem F
Falling Mugs


Susan is making high-speed videos of falling coffee mugs. When analyzing the videos she wants to know how big the mugs are, but unfortunately they all got destroyed during filming. Susan knows some physics though, so she has figured out how far they moved between different video frames. The camera was filming at a speed of $70$ frames per second, which means that at frame $n$, counted from when the mug was released, the number of millimeters it has moved is $d=n^2$. The counting of the frames starts at $0$.

Susan thinks a certain mug is $D$ millimeters high, but to verify this she needs to find two frames between which the mug has moved exactly this distance. Can you help her do this?


The input file contains the single positive integer $D\leq 200\, 000$, the distance to be measured.


Output two non-negative integers $n_1$ and $n_2$, the numbers of the frames that Susan should compare. They should fulfill $n_2^2-n_1^2=D$. If no two such integers exist, instead output “impossible”.

Sample Input 1 Sample Output 1
9 13
Sample Input 2 Sample Output 2