#4986. Problem 2. Transforming Pairs
0
Problem 2. Transforming Pairs
Problem 2. Transforming Pairs
USACO 2025 February Contest, Platinum
Answer () independent queries each of the following form:
You are given four integers (). In one operation you can either do , or . Determine the minimum number of operations to transform into , or if it is impossible to do so, output .
INPUT FORMAT (input arrives from the terminal / stdin):
The first line contains .
The next lines each contain four integers .
OUTPUT FORMAT (print output to the terminal / stdout):
The answer for each query on a separate line.
SAMPLE INPUT:
4 5 -3 -1 -3 5 3 5 2 5 3 8 19 5 3 5 3
SAMPLE OUTPUT:
2 -1 3 0
First query:
Second query: Impossible.
Third query:
Fourth query: No operations necessary.
SCORING: Input 2: Input 3: Input 4: Input 5: Input 6: Input 7: Input 8: Input 9: Input 10: Inputs 11-14: Inputs 15-19: No additional constraints.
Problem credits: Benjamin Qi