Organizing a contest is not an easy job. There are lots to prepare, such as authoring problems, creating test cases, inviting participants etc. To prepare the venues for the Pre-HKSC Contest, the organizers have borrowed the computer rooms in WYK.
There are two computer rooms in WYK, which are named CALC and AI Lab respectively. CALC has $A$ computers while AI Lab has $B$ computers. There are $N$ contestants joining the contest, a contestant occupies exactly $1$ computer during the contest.
However, the contest organizers are too busy preparing the problems, so they asked you to help them create a seating plan. Your mission is to split the $N$ contestants into two rooms, with the first room consisting of $X$ people and the second room consisting of $Y$ people (You have to decide the values of $X$ and $Y$). Additionally, there are some rules that the seating plan must follow:
- Both rooms must consist of at least $1$ contestant.
- All contestants must be split into one of the two rooms.
- For each room, the number of computers must be sufficient for the contestants.
If there isn't a way to satisfy the above conditions, output $-1$.
Otherwise, the organizers wants the number of contestants in both rooms to be as close as possible. Therefore, your task is to minimize the difference between $X$ and $Y$ while satisfying the above conditions. Time is running short! Can you finish the task?
Input
The only line contains three integers $N, A$ and $B$.
Output
If there isn't a solution, output $-1$.
Otherwise, output two integers $X$ and $Y$, denoting your decision on the seating plan.
If there are multiple answers, any of them will be accepted.
Subtasks
For all test cases:
- $2 \le N \le 10^{18}$
- $1 \le A, B \le 10^{18}$
| Subtask | Score | Additional Constraints |
|---|---|---|
| $1$ | $20$ | $A, B \ge N$ |
| $1$ | $35$ | $N, A, B \le 10^7$ |
| $2$ | $30$ | $N$ is even |
| $3$ | $15$ | No Additional Constraints |
Sample Test Cases
| Input | Output | |
|---|---|---|
| 6 4 5 | 3 3 | |
We can assign $3$ contestants to both rooms without exceeding room capacity. Moreover, the difference in the number of contestants in both rooms is $3 - 3 = 0$, which is minimized. |
||
| 9 3 8 | 3 6 | |
Scoring: Per Subtask
Authored by s22f26
Appeared in 2026 Mini Comp 5 (Pre-HKSC)