Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[問題案] GCD of Gaussian Integers #958

Closed
NachiaVivias opened this issue Apr 18, 2023 · 5 comments
Closed

[問題案] GCD of Gaussian Integers #958

NachiaVivias opened this issue Apr 18, 2023 · 5 comments
Assignees
Labels

Comments

@NachiaVivias
Copy link
Collaborator

Problem name: GCD of Gaussian Integers
Problem ID: gcd_of_gaussian_integers

Problem

$t=0, \ldots ,Q-1$ について、ガウス整数 $a _ t + b _ t i$ , $c _ t + d _ t i$ の最大公約数 $x _ t + y _ t i$ を求めてください。

Constraint

  • $1\leq a _ t ^ 2 + b _ t ^ 2$
  • $1\leq c _ t ^ 2 + d _ t ^ 2$

Input

$Q$
$a _ 0$ $b _ 0$ $c _ 0$ $d _ 0$
$a _ 1$ $b _ 1$ $c _ 1$ $d _ 1$
$\vdots$
$a _ {Q-1}$ $b _ {Q-1}$ $c _ {Q-1}$ $d _ {Q-1}$

Output

$x _ 0$ $y _ 0$
$x _ 1$ $y _ 1$
$\vdots$
$x _ {Q-1}$ $y _ {Q-1}$

Note

originally posted by hec12 : #3 (comment)

@noshi91
Copy link
Collaborator

noshi91 commented Apr 18, 2023

$\gcd (0, x) = x$$\gcd(0, 0) = 0$ も入れて良いのではと思います。

単数倍についてはどうすると良いでしょうか。入力は正規化されていないとして、出力を正規化させるか、なんでも OK にするか。

@NachiaVivias
Copy link
Collaborator Author

単数倍はまず #895 で議論して、その後に $0$ のことを決めるのがよさそうです。

@maspypy
Copy link
Collaborator

maspypy commented Apr 28, 2023

$0$ は入れてよいと思います。 $4$ 通りのうちいずれかを出力でよいと思います。
$|a_i|\leq 10^9$ という感じの制約がつくのだと思っています。

@maspypy
Copy link
Collaborator

maspypy commented Jun 7, 2023

出力は単数倍の自由度を認める(ジャッジを実装する)ということでお願いします。

@maspypy maspypy added the contributions-welcome 審査済み label Jun 7, 2023
@maspypy
Copy link
Collaborator

maspypy commented Aug 9, 2023

作業します。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants