103405: [Atcoder]ABC340 F - S = 1

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:3 Solved:0

Description

Score: $525$ points

Problem Statement

You are given integers $X$ and $Y$, which satisfy at least one of $X \neq 0$ and $Y \neq 0$.
Find a pair of integers $(A, B)$ that satisfies all of the following conditions. If no such pair exists, report so.

  • $-10^{18} \leq A, B \leq 10^{18}$
  • The area of the triangle with vertices at points $(0, 0), (X, Y), (A, B)$ on the $xy$-plane is $1$.

Constraints

  • $-10^{17} \leq X, Y \leq 10^{17}$
  • $(X, Y) \neq (0, 0)$
  • $X$ and $Y$ are integers.

Input

The input is given from Standard Input in the following format:

$X$ $Y$

Output

If there is a pair of integers $(A, B)$ that satisfies the conditions, print it in the following format:

$A$ $B$

Otherwise, print -1.


Sample Input 1

3 5

Sample Output 1

1 1

The area of the triangle with vertices at points $(0, 0), (3, 5), (1, 1)$ is $1$. Thus, $(A, B) = (1, 1)$ satisfies the conditions.


Sample Input 2

-2 0

Sample Output 2

0 1

Sample Input 3

8752654402832944 -6857065241301125

Sample Output 3

-1

Input

Output

分数:525分

问题描述

给你两个整数 $X$ 和 $Y$,它们至少满足 $X \neq 0$ 或者 $Y \neq 0$。
找出一个整数对 $(A, B)$,满足以下所有条件。如果不存在这样的整数对,请报告。

  • $-10^{18} \leq A, B \leq 10^{18}$
  • 在 $xy$ 平面上,顶点分别为 $(0, 0), (X, Y), (A, B)$ 的三角形的面积为 $1$。

约束条件

  • $-10^{17} \leq X, Y \leq 10^{17}$
  • $(X, Y) \neq (0, 0)$
  • $X$ 和 $Y$ 是整数。

输入

输入从标准输入以以下格式给出:

$X$ $Y$

输出

如果存在满足条件的整数对 $(A, B)$,请以以下格式输出:

$A$ $B$

否则,输出 -1


样例输入 1

3 5

样例输出 1

1 1

顶点分别为 $(0, 0), (3, 5), (1, 1)$ 的三角形的面积为 $1$。因此,$(A, B) = (1, 1)$ 满足条件。


样例输入 2

-2 0

样例输出 2

0 1

样例输入 3

8752654402832944 -6857065241301125

样例输出 3

-1

加入题单

算法标签: