CF1776I.Spinach Pizza

省选/NOI-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

The two siblings Alberto and Beatrice have to eat a spinach pizza together. However, none of them likes spinach, so they both want to eat as little as possible.

The pizza has the shape of a strictly convex polygon with nn vertices located at integer coordinates (x1,y1), (x2,y2), …, (xn,yn)(x_1, y_1), \, (x_2, y_2), \, \dots, \, (x_n, y_n) of the plane.

The siblings have decided to eat the pizza in the following way: taking turns, starting with Alberto, each sibling chooses a vertex of the remaining part of the pizza and eats out the triangle determined by its two neighboring edges. In this way, after each of the first n−3n - 3 turns the pizza will have one less vertex. The game ends after the (n−2)(n - 2)-th turn, when all the pizza has been eaten.

Assuming that Alberto and Beatrice choose the slices to eat optimally, which of the siblings manages to eat at most half of the pizza? You should identify a sibling that has a strategy to do so and help them choose the slices appropriately. Note that it is possible that both Alberto and Beatrice end up eating exactly half of the area if they choose their slices optimally.

两位兄妹阿尔贝托(Alberto)与贝亚特丽切(Beatrice)需共同吃完一块菠菜披萨。然而,他们俩都不喜欢菠菜,因此都希望尽可能少吃。

该披萨呈严格凸 nn 边形,其 nn 个顶点位于平面上的整数坐标 (x1,y1), (x2,y2), …, (xn,yn)(x_1, y_1),\, (x_2, y_2),\, \dots,\, (x_n, y_n) 处。

兄妹二人约定按如下方式分食披萨:两人轮流进行,阿尔贝托先手;每轮中,当前轮到的一方从当前剩余披萨的顶点中选择一个顶点,并吃掉由该顶点及其两条邻边所确定的三角形区域。如此操作后,前 n−3n - 3 轮中的每一轮都会使披萨的顶点数减少一个。游戏在第 (n−2)(n - 2) 轮结束后终止,此时整块披萨已被全部吃完。

假设阿尔贝托与贝亚特丽切均以最优策略选取要吃的三角形片,请问:哪一位兄妹能够确保自己所吃的披萨面积至多为整块披萨面积的一半?你应明确指出拥有该保证策略的一方,并为其提供相应的选片方案。注意:在双方均采取最优策略的情况下,也有可能两人最终恰好各吃掉披萨面积的一半。

输入格式

The first line contains a single integer nn (4≤n≤1004 \le n \le 100) — the number of vertices.

The next nn lines contain two integers xix_i and yiy_i each (−106≤xi,yi≤106-10^6 \le x_i, y_i \le 10^6) — the coordinates of the ii-th vertex of the polygon representing the initial shape of the pizza.

It is guaranteed that the polygon is strictly convex and that its vertices are given in counterclockwise order.

第一行包含一个整数 nn(4≤n≤1004 \le n \le 100)—— 表示顶点的数量。

接下来的 nn 行,每行包含两个整数 xix_i 和 yiy_i(−106≤xi,yi≤106-10^6 \le x_i, y_i \le 10^6)—— 表示表示披萨初始形状的多边形的第 ii 个顶点的坐标。

保证该多边形是严格凸的,且其顶点按逆时针顺序给出。

输入输出样例

  • 输入#1

    4
    0 0
    6 1
    5 3
    1 4

    输出#1

    -
  • 输入#2

    6
    0 0
    2 0
    3 2
    2 4
    0 4
    -1 2

    输出#2

    -
  • 输入#3

    7
    0 0
    2 0
    5 2
    4 5
    1 5
    -1 4
    -1 2

    输出#3

    -

说明/提示

In the first sample, the pizza has area 1515. Alberto can eat less than half of the pizza by eating the slice around vertex 22 (which has area 6.56.5) or around vertex 33 (which has area 3.53.5).

In the second sample, it can be proved that both players will eat exactly half of the pizza if they eat optimally. Therefore it is possible to choose to help either Alberto or Beatrice.

In the third sample, it is possible to show that only Beatrice has a strategy to eat at most half of the pizza. The following is an example of a valid interaction (after reading the input):

\\begin{array}{|c|c|c|} \\hline \\textbf{Contestant} & \\textbf{Judge} & \\textbf{Explanation} \\\\ \\hline \\texttt{Beatrice} & & \\text{The contestant will help Beatrice} \\\\ \\hline & \\texttt{7} & \\text{Alberto eats the triangle with vertices $6$, $7$, $1$ and area $1$} \\\\ \\hline \\texttt{2} & & \\text{Beatrice eats the triangle with vertices $1$, $2$, $3$ and area $2$} \\\\ \\hline & \\texttt{5} & \\text{Alberto eats the triangle with vertices $4$, $5$, $6$ and area $1.5$} \\\\ \\hline \\texttt{4} & & \\text{Beatrice eats the triangle with vertices $3$, $4$, $6$ and area $8$} \\\\ \\hline & \\texttt{6} & \\text{Alberto eats the triangle with vertices $3$, $6$, $1$ and area $11$} \\\\ \\hline \\end{array} $$ The total area eaten by Alberto is $13.5$ and the total area eaten by Beatrice is $10$, which is less than half the area of the whole pizza. The actions performed by the contestant and the judge in this example of interaction may be non-optimal. The process is illustrated below: ![](https://pms-wscdn.xmwol.com/image/28da1945a0634780b27fc14b4f3ef974.png) 在第一个样例中,披萨的面积为 $15$。阿尔贝托可以通过吃围绕顶点 $2$ 的切片(面积为 $6.5$)或围绕顶点 $3$ 的切片(面积为 $3.5$)来吃掉少于披萨一半的面积。 ![](https://pms-wscdn.xmwol.com/image/b41f024e3b684d2bb5674028d4a32fe9.png) 在第二个样例中,可以证明:若双方均采取最优策略,则两人将恰好各吃掉披萨的一半。因此,此时可任选帮助阿尔贝托或贝亚特丽斯。 在第三个样例中,可以证明:仅贝亚特丽斯拥有策略,使其所吃面积至多为披萨总面积的一半。以下是一个合法交互过程的示例(在读入输入之后): $$ \begin{array}{|c|c|c|} \hline \textbf{选手} & \textbf{裁判} & \textbf{说明} \\ \hline \texttt{Beatrice} & & \text{选手将帮助贝亚特丽斯} \\ \hline & \texttt{7} & \text{阿尔贝托吃掉以顶点 $6$、$7$、$1$ 为顶点且面积为 $1$ 的三角形} \\ \hline \texttt{2} & & \text{贝亚特丽斯吃掉以顶点 $1$、$2$、$3$ 为顶点且面积为 $2$ 的三角形} \\ \hline & \texttt{5} & \text{阿尔贝托吃掉以顶点 $4$、$5$、$6$ 为顶点且面积为 $1.5$ 的三角形} \\ \hline \texttt{4} & & \text{贝亚特丽斯吃掉以顶点 $3$、$4$、$6$ 为顶点且面积为 $8$ 的三角形} \\ \hline & \texttt{6} & \text{阿尔贝托吃掉以顶点 $3$、$6$、$1$ 为顶点且面积为 $11$ 的三角形} \\ \hline \end{array} $$ 阿尔贝托总共吃掉的面积为 $13.5$,贝亚特丽斯总共吃掉的面积为 $10$,小于整个披萨面积的一半。本示例中选手与裁判所执行的动作未必是最优的。该过程示意如下: ![](https://pms-wscdn.xmwol.com/image/28da1945a0634780b27fc14b4f3ef974.png)

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

首页