CF549E.Sasha Circle

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Berlanders like to eat cones after a hard day. Misha Square and Sasha Circle are local authorities of Berland. Each of them controls its points of cone trade. Misha has n points, Sasha — m. Since their subordinates constantly had conflicts with each other, they decided to build a fence in the form of a circle, so that the points of trade of one businessman are strictly inside a circle, and points of the other one are strictly outside. It doesn't matter which of the two gentlemen will have his trade points inside the circle.

Determine whether they can build a fence or not.

伯兰德人喜欢在辛苦工作一天后吃甜筒。米沙·斯夸尔(Misha Square)和萨沙·圆圈(Sasha Circle)是伯兰德当地的权威人物,各自掌控若干个甜筒销售点:米沙有 nn 个销售点,萨沙有 mm 个销售点。由于双方下属之间频繁发生冲突,他们决定修建一道圆形围栏,使得其中一位商人的所有销售点严格位于圆内,而另一位商人的所有销售点严格位于圆外。至于哪位商人的销售点位于圆内,这并不重要。

请判断他们能否修建这样一道围栏。

输入格式

The first line contains two integers n and m (1 ≤ n, m ≤ 10000), numbers of Misha's and Sasha's trade points respectively.

The next n lines contains pairs of space-separated integers M__x, M__y ( - 104 ≤ M__x, M__y ≤ 104), coordinates of Misha's trade points.

The next m lines contains pairs of space-separated integers S__x, S__y ( - 104 ≤ S__x, S__y ≤ 104), coordinates of Sasha's trade points.

It is guaranteed that all n + m points are distinct.

第一行包含两个整数 nn 和 mm(1≤n,m≤100001 \leq n, m \leq 10000),分别表示米沙和萨沙的交易点数量。

接下来的 nn 行,每行包含一对用空格分隔的整数 Mx, MyM_x,\ M_y(−104≤Mx,My≤104-10^4 \leq M_x, M_y \leq 10^4),表示米沙的交易点坐标。

接下来的 mm 行,每行包含一对用空格分隔的整数 Sx, SyS_x,\ S_y(−104≤Sx,Sy≤104-10^4 \leq S_x, S_y \leq 10^4),表示萨沙的交易点坐标。

保证全部 n+mn + m 个点互不相同。

输出格式

The only output line should contain either word "YES" without quotes in case it is possible to build a such fence or word "NO" in the other case.

唯一的一行输出应包含单词“YES”(不带引号),表示可以建造这样的围栏;否则,输出单词“NO”。

输入输出样例

  • 输入#1

    2 2
    -1 0
    1 0
    0 -1
    0 1

    输出#1

    NO
  • 输入#2

    4 4
    1 0
    0 1
    -1 0
    0 -1
    1 1
    -1 1
    -1 -1
    1 -1

    输出#2

    YES

说明/提示

In the first sample there is no possibility to separate points, because any circle that contains both points ( - 1, 0), (1, 0) also contains at least one point from the set (0,  - 1), (0, 1), and vice-versa: any circle that contains both points (0,  - 1), (0, 1) also contains at least one point from the set ( - 1, 0), (1, 0)

In the second sample one of the possible solution is shown below. Misha's points are marked with red colour and Sasha's are marked with blue.

在第一个样例中,无法将点分离,因为任何包含两点 (−1,0)(-1, 0)、(1,0)(1, 0) 的圆,也必定包含集合 {(0,−1),(0,1)}\{(0, -1), (0, 1)\} 中至少一个点;反之,任何包含两点 (0,−1)(0, -1)、(0,1)(0, 1) 的圆,也必定包含集合 {(−1,0),(1,0)}\{(-1, 0), (1, 0)\} 中至少一个点。

在第二个样例中,一种可能的解如下图所示。米沙的点用红色标记,萨沙的点用蓝色标记。

输入解题思路,AI测评打分。不知道怎么写?

首页