#P9373. Excellent Partition
Excellent Partition
Excellent Partition
For given non-negative integers n and k, we call an ordered pair \((x,y)\) an excellent partition of \(n\) if there exist a non-negative integer \(x\) and a positive integer \(y\) such that:
\[ x + y = n \quad \land \quad x \bmod y = k \]
Recall that in modular arithmetic, \(x \bmod y\) is the remainder when \(x\) is divided by \(y\). In this problem, you are given \(n\) and \(k\) and need to construct any excellent partition of \(n\). Specifically, if there exists a positive integer \(y\) (with \(y \le n\)) such that \(n \bmod y = k\) (since \(x = n-y\)), output \(x = n-y\) and \(y\). Otherwise, if no such partition exists, output -1
.
Note: The symbol \(\land\) means "and".
inputFormat
The input consists of a single line containing two space-separated non-negative integers \(n\) and \(k\).
outputFormat
If an excellent partition exists, output two integers \(x\) and \(y\) separated by a space. Otherwise, output -1
.
sample
10 2
6 4