QOJ.ac

QOJ

Límite de tiempo: 2.0 s Límite de memoria: 256 MB Puntuación total: 100

#18092. 完璧な贈り物

Estadísticas

Tajaは誕生日のプレゼントを準備しています。ご存知の通り、最高のプレゼントとは自分で手作りしたものです。最近彼女はクロスステッチを習い、この技術を活かすことにしました。

家にあるキャンバスには、すでに2つのクロスステッチが縫い付けられていました。慌てる必要はありません。いつでもそれを補完して完全な絵にすることができます。彼女は経験が浅いため、シンプルでありながら美しい絵として平行六面体を選びました。彼女はできるだけ早くプレゼントを完成させたいと考えているため、新たに追加するクロスステッチの数は最小限である必要があります。

無限グリッド上の平行六面体は次のように描かれます。

まず、左上の角を $A$、右下の角を $C$ とする長方形 $ABCD$ を描きます。

次に、$A, B, C$ から右上に向かって等しい長さの線分を引き、それぞれの端を $E, F, G$ とします。その後、線分 $EF$ と $FG$ を追加します。

平行六面体のすべての辺は、少なくとも $3$ マスの長さが必要です。

入力

入力の1行目には、最初のクロスステッチの座標 $x_1, y_1$ が含まれます。2行目には、2番目のクロスステッチの座標 $x_2, y_2$ が含まれます。2つのクロスステッチの座標は異なります。軸 $OX$ は左から右へ、軸 $OY$ は下から上へと向いています。すべての数値は $[0, 10^9]$ の範囲内です。

出力

必要なクロスステッチの最小数を1つの数値で出力してください。

入出力例

入力 1

4 2
9 3

出力 1

17

入力 2

0 0
1 1

出力 2

14

注記

これらの図はサンプルに対応しています。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.