A. Find Extra One

Codeforces
IDCF900A
Time1000ms
Memory256MB
Difficulty
geometryimplementation
English · Original
Chinese · Translation
Formal · Original
You have _n_ distinct points on a plane, none of them lie on _OY_ axis. Check that there is a point after removal of which the remaining points are located on one side of the _OY_ axis. ## Input The first line contains a single positive integer _n_ (2 ≤ _n_ ≤ 105). The following _n_ lines contain coordinates of the points. The _i_\-th of these lines contains two single integers _x__i_ and _y__i_ (|_x__i_|, |_y__i_| ≤ 109, _x__i_ ≠ 0). No two points coincide. ## Output Print "_Yes_" if there is such a point, "_No_" — otherwise. You can print every letter in any case (upper or lower). [samples] ## Note In the first example the second point can be removed. In the second example there is no suitable for the condition point. In the third example any point can be removed.
你平面上有 #cf_span[n] 个互不相同的点,且没有任何一个点位于 #cf_span[OY] 轴上。请判断是否存在一个点,将其移除后,剩余的点全部位于 #cf_span[OY] 轴的同一侧。 第一行包含一个正整数 #cf_span[n](#cf_span[2 ≤ n ≤ 105])。 接下来的 #cf_span[n] 行每行包含一个点的坐标。第 #cf_span[i] 行包含两个整数 #cf_span[xi] 和 #cf_span[yi](#cf_span[|xi|, |yi| ≤ 109],#cf_span[xi ≠ 0])。没有两个点重合。 如果存在这样的点,请输出 "_Yes_",否则输出 "_No_"。 你可以以任意大小写形式输出每个字母。 在第一个例子中,可以移除第二个点。 在第二个例子中,不存在满足条件的点。 在第三个例子中,任意一个点都可以被移除。 ## Input 第一行包含一个正整数 #cf_span[n](#cf_span[2 ≤ n ≤ 105])。接下来的 #cf_span[n] 行每行包含一个点的坐标。第 #cf_span[i] 行包含两个整数 #cf_span[xi] 和 #cf_span[yi](#cf_span[|xi|, |yi| ≤ 109],#cf_span[xi ≠ 0])。没有两个点重合。 ## Output 如果存在这样的点,请输出 "_Yes_",否则输出 "_No_"。你可以以任意大小写形式输出每个字母。 [samples] ## Note 在第一个例子中,可以移除第二个点。在第二个例子中,不存在满足条件的点。在第三个例子中,任意一个点都可以被移除。
**Definitions** Let $ n \in \mathbb{Z} $, $ 2 \leq n \leq 10^5 $, be the number of points. Let $ P = \{ (x_i, y_i) \mid i \in \{1, \dots, n\} \} $ be a set of distinct points in $ \mathbb{R}^2 $, with $ x_i \neq 0 $ for all $ i $. **Constraints** For all $ i \in \{1, \dots, n\} $: - $ |x_i|, |y_i| \leq 10^9 $ - $ x_i \neq 0 $ - All points are distinct. **Objective** Determine whether there exists a point $ p \in P $ such that all points in $ P \setminus \{p\} $ lie on the same side of the $ OY $-axis (i.e., all have $ x > 0 $ or all have $ x < 0 $). Output "Yes" if such a point exists, "No" otherwise.
Samples
Input #1
3
1 1
-1 -1
2 -1
Output #1
Yes
Input #2
4
1 1
2 2
-1 1
-2 2
Output #2
No
Input #3
3
1 2
2 1
4 60
Output #3
Yes
API Response (JSON)
{
  "problem": {
    "name": "A. Find Extra One",
    "description": {
      "content": "You have _n_ distinct points on a plane, none of them lie on _OY_ axis. Check that there is a point after removal of which the remaining points are located on one side of the _OY_ axis.",
      "description_type": "Markdown"
    },
    "platform": "Codeforces",
    "limit": {
      "time_limit": 1000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "CF900A"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "You have _n_ distinct points on a plane, none of them lie on _OY_ axis. Check that there is a point after removal of which the remaining points are located on one side of the _OY_ axis.\n\n## Input\n\nThe...",
      "is_translate": false,
      "language": "English"
    },
    {
      "statement_type": "Markdown",
      "content": "你平面上有 #cf_span[n] 个互不相同的点,且没有任何一个点位于 #cf_span[OY] 轴上。请判断是否存在一个点,将其移除后,剩余的点全部位于 #cf_span[OY] 轴的同一侧。\n\n第一行包含一个正整数 #cf_span[n](#cf_span[2 ≤ n ≤ 105])。\n\n接下来的 #cf_span[n] 行每行包含一个点的坐标。第 #cf_span[i] 行包含两个整数 #...",
      "is_translate": true,
      "language": "Chinese"
    },
    {
      "statement_type": "Markdown",
      "content": "**Definitions**  \nLet $ n \\in \\mathbb{Z} $, $ 2 \\leq n \\leq 10^5 $, be the number of points.  \nLet $ P = \\{ (x_i, y_i) \\mid i \\in \\{1, \\dots, n\\} \\} $ be a set of distinct points in $ \\mathbb{R}^2 $, ...",
      "is_translate": false,
      "language": "Formal"
    }
  ]
}
Full JSON Raw Segments