問題一覧 > 通常問題

No.3042 Enlarged Copy

レベル : / AI推定難易度 : 1300 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 小数誤差許容問題 絶対誤差または相対誤差が $10^{-3}$ 以下。ただし、ジャッジ側の都合で500桁未満にしてください
タグ : (AC するまで非表示) / 解いたユーザー数 47
作問者 : Blue_S / テスター : eiram nauclhlt naniwazu
お気に入りにしたユーザー ProblemId : 11813 / 自分の提出
問題文最終更新日: 2026-10-20 17:43:26
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 458 (順位表) の他の問題:

Problem Statement

The photos mentioned below are rectangular. The lower-left corner is taken as the origin, and along the edges of the photo the $x$ coordinate is taken to the right and the $y$ coordinate upward. Coordinates are in units of $mm$.

There is a photo of stars. In it there are $N$ stars, and their positions are $(x_i, y_i) ~ (1 \le i \le N)$. The photo was pasted onto another large white sheet of paper so that no star sticks out of the paper. At this time, the orientation and position of the pasting were chosen very carelessly.
The white paper was then enlarged (reduction is also possible) with a copy machine and made into a photo. As a result, the positions of the stars became $(z_j, w_j) ~ (1 \le j \le N)$, though not necessarily in the original order.

By what factor was the copy made? An absolute error of less than $10^{-3}$ is allowed.
Here, copying means a similarity enlargement centered at the lower-left corner of the white paper.

Input

$N$
$x_1\ y_1$
.
.
.
$x_N\ y_N$
$z_1\ w_1$
.
.
.
$z_N\ w_N$

$2 \le N \le 10^6$
$x_i, y_i, z_j, w_j ~ (1 \le i \le N, 1 \le j \le N)$ are decimals.
$(x_i, y_i) \neq (x_j, y_j) ~ (i \neq j)$
$0 \le x_i, y_i, z_j, w_j \le 10^9 ~ (1 \le i \le N, 1 \le j \le N)$
$(x_i, y_i)$ does not necessarily move to $(z_i, w_i)$.

Output

ans
Print a newline at the end.

Sample

Sample 1
Input
2
1 1
2 2
4 4
2 2
2

If we regard $(1, 1)$ as corresponding to $(2, 2)$ and $(2, 2)$ as corresponding to $(4, 4)$, we can consider that the photo was pasted so that its lower-left corner coincides with that of the white paper, and that a $2$-times copy was made. Note that, as in this example, the copy destinations do not necessarily match in the order of the input.

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。