B. Arpa and an exam about geometry

Codeforces
IDCF851B
Time2000ms
Memory256MB
Difficulty
geometrymath
English · Original
Chinese · Translation
Formal · Original
Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points _a_, _b_, _c_. Find a point and an angle such that if we rotate the page around the point by the angle, the new position of _a_ is the same as the old position of _b_, and the new position of _b_ is the same as the old position of _c_. Arpa is doubting if the problem has a solution or not (i.e. if there exists a point and an angle satisfying the condition). Help Arpa determine if the question has a solution or not. ## Input The only line contains six integers _a__x_, _a__y_, _b__x_, _b__y_, _c__x_, _c__y_ (|_a__x_|, |_a__y_|, |_b__x_|, |_b__y_|, |_c__x_|, |_c__y_| ≤ 109). It's guaranteed that the points are distinct. ## Output Print "_Yes_" if the problem has a solution, "_No_" otherwise. You can print each letter in any case (upper or lower). [samples] ## Note In the first sample test, rotate the page around (0.5, 0.5) by . In the second sample test, you can't find any solution.
Arpa 正在参加一场几何考试。这是考试的最后一道题。 给你三个点 #cf_span[a, b, c]。 请找出一个点和一个角度,使得将纸张绕该点旋转该角度后,#cf_span[a] 的新位置与 #cf_span[b] 的原位置相同,且 #cf_span[b] 的新位置与 #cf_span[c] 的原位置相同。 Arpa 怀疑这个问题是否有解(即是否存在满足条件的点和角度)。请帮助 Arpa 判断该问题是否有解。 输入仅一行,包含六个整数 #cf_span[ax, ay, bx, by, cx, cy](#cf_span[|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 10^9])。保证这三个点互不相同。 如果问题有解,请输出 "_Yes_",否则输出 "_No_"。 你可以以任意大小写形式输出每个字母。 在第一个样例中,将纸张绕 #cf_span[(0.5, 0.5)] 旋转 。 在第二个样例中,你无法找到任何解。 ## Input 输入仅一行,包含六个整数 #cf_span[ax, ay, bx, by, cx, cy](#cf_span[|ax|, |ay|, |bx|, |by|, |cx|, |cy| ≤ 10^9])。保证这三个点互不相同。 ## Output 如果问题有解,请输出 "_Yes_",否则输出 "_No_"。你可以以任意大小写形式输出每个字母。 [samples] ## Note 在第一个样例中,将纸张绕 #cf_span[(0.5, 0.5)] 旋转 。在第二个样例中,你无法找到任何解。
**Definitions** Let $ A = (a_x, a_y) $, $ B = (b_x, b_y) $, $ C = (c_x, c_y) \in \mathbb{R}^2 $ be three distinct points. **Constraints** $ |a_x|, |a_y|, |b_x|, |b_y|, |c_x|, |c_y| \leq 10^9 $, and $ A \neq B \neq C \neq A $. **Objective** Determine whether there exists a point $ P \in \mathbb{R}^2 $ and an angle $ \theta \in \mathbb{R} $ such that a rotation about $ P $ by $ \theta $ maps: - $ A \mapsto B $, - $ B \mapsto C $. **Condition for Solution** Such a rotation exists if and only if: $$ |A - B| = |B - C| \quad \text{and} \quad A, B, C \text{ are not collinear}. $$
Samples
Input #1
0 1 1 1 1 0
Output #1
Yes
Input #2
1 1 0 0 1000 1000
Output #2
No
API Response (JSON)
{
  "problem": {
    "name": "B. Arpa and an exam about geometry",
    "description": {
      "content": "Arpa is taking a geometry exam. Here is the last problem of the exam. You are given three points _a_, _b_, _c_. Find a point and an angle such that if we rotate the page around the point by the angl",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF851B"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Arpa is taking a geometry exam. Here is the last problem of the exam.\n\nYou are given three points _a_, _b_, _c_.\n\nFind a point and an angle such that if we rotate the page around the point by the angl...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "Arpa 正在参加一场几何考试。这是考试的最后一道题。\n\n给你三个点 #cf_span[a, b, c]。\n\n请找出一个点和一个角度,使得将纸张绕该点旋转该角度后,#cf_span[a] 的新位置与 #cf_span[b] 的原位置相同,且 #cf_span[b] 的新位置与 #cf_span[c] 的原位置相同。\n\nArpa 怀疑这个问题是否有解(即是否存在满足条件的点和角度)。请帮助 Arpa...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ A = (a_x, a_y) $, $ B = (b_x, b_y) $, $ C = (c_x, c_y) \\in \\mathbb{R}^2 $ be three distinct points.\n\n**Constraints**  \n$ |a_x|, |a_y|, |b_x|, |b_y|, |c_x|, |c_y| \\leq 10^9 $, a...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments