C. Vectors

Codeforces
IDCF101C
Time1000ms
Memory256MB
Difficulty
implementationmath
English · Original
Chinese · Translation
Formal · Original
At a geometry lesson Gerald was given a task: to get vector _B_ out of vector _A_. Besides, the teacher permitted him to perform the following operations with vector _А_: * Turn the vector by 90 degrees clockwise. * Add to the vector a certain vector _C_. Operations could be performed in any order any number of times. Can Gerald cope with the task? ## Input The first line contains integers _x_1 и _y_1 — the coordinates of the vector _A_ ( - 108 ≤ _x_1, _y_1 ≤ 108). The second and the third line contain in the similar manner vectors _B_ and _C_ (their coordinates are integers; their absolute value does not exceed 108). ## Output Print "_YES_" (without the quotes) if it is possible to get vector _B_ using the given operations. Otherwise print "_NO_" (without the quotes). [samples]
在一次几何课上,Gerald 被布置了一个任务:用向量 #cf_span[A] 得到向量 #cf_span[B]。此外,老师允许他对向量 #cf_span[A] 执行以下操作: 这些操作可以以任意顺序执行任意多次。 Gerald 能否完成这个任务? 第一行包含整数 #cf_span[x1] 和 #cf_span[y1] —— 向量 #cf_span[A] 的坐标(#cf_span[ - 108 ≤ x1, y1 ≤ 108])。第二行和第三行以类似方式给出向量 #cf_span[B] 和 #cf_span[C](它们的坐标为整数,绝对值不超过 #cf_span[108])。 如果可以通过给定操作得到向量 #cf_span[B],请输出 "_YES_"(不含引号);否则输出 "_NO_"(不含引号)。 ## Input 第一行包含整数 #cf_span[x1] 和 #cf_span[y1] —— 向量 #cf_span[A] 的坐标(#cf_span[ - 108 ≤ x1, y1 ≤ 108])。第二行和第三行以类似方式给出向量 #cf_span[B] 和 #cf_span[C](它们的坐标为整数,绝对值不超过 #cf_span[108])。 ## Output 如果可以通过给定操作得到向量 #cf_span[B],请输出 "_YES_"(不含引号);否则输出 "_NO_"(不含引号)。 [samples]
**Definitions** Let $ \mathbf{A} = (x_1, y_1) $, $ \mathbf{B} = (x_2, y_2) $, $ \mathbf{C} = (x_3, y_3) $ be vectors in $ \mathbb{Z}^2 $. **Constraints** All coordinates are integers: $ x_1, y_1, x_2, y_2, x_3, y_3 \in \mathbb{Z} $, and $ |x_i|, |y_i| \leq 10^8 $ for $ i \in \{1,2,3\} $. **Objective** Determine whether there exist integers $ m, n \in \mathbb{Z} $ such that: $$ \mathbf{B} = \mathbf{A} + m \mathbf{C} + n (-\mathbf{C}) $$ or equivalently, $$ \mathbf{B} - \mathbf{A} = k \mathbf{C} \quad \text{for some } k \in \mathbb{Z}. $$
Samples
Input #1
0 0
1 1
0 1
Output #1
YES
Input #2
0 0
1 1
1 1
Output #2
YES
Input #3
0 0
1 1
2 2
Output #3
NO
API Response (JSON)
{
  "problem": {
    "name": "C. Vectors",
    "description": {
      "content": "At a geometry lesson Gerald was given a task: to get vector _B_ out of vector _A_. Besides, the teacher permitted him to perform the following operations with vector _А_: *   Turn the vector by 90 de",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF101C"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "At a geometry lesson Gerald was given a task: to get vector _B_ out of vector _A_. Besides, the teacher permitted him to perform the following operations with vector _А_:\n\n*   Turn the vector by 90 de...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "在一次几何课上,Gerald 被布置了一个任务:用向量 #cf_span[A] 得到向量 #cf_span[B]。此外,老师允许他对向量 #cf_span[A] 执行以下操作:\n\n这些操作可以以任意顺序执行任意多次。\n\nGerald 能否完成这个任务?\n\n第一行包含整数 #cf_span[x1] 和 #cf_span[y1] —— 向量 #cf_span[A] 的坐标(#cf_span[ - 10...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ \\mathbf{A} = (x_1, y_1) $, $ \\mathbf{B} = (x_2, y_2) $, $ \\mathbf{C} = (x_3, y_3) $ be vectors in $ \\mathbb{Z}^2 $.\n\n**Constraints**  \nAll coordinates are integers: $ x_1, y_1,...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments