CF852C.Property

提高+/省选-

通过率:0%

时间限制:0.50s

内存限制:256MB

AC君温馨提醒

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

题目描述

Bill is a famous mathematician in BubbleLand. Thanks to his revolutionary math discoveries he was able to make enough money to build a beautiful house. Unfortunately, for not paying property tax on time, court decided to punish Bill by making him lose a part of his property.

Bill’s property can be observed as a convex regular 2_n_-sided polygon _A_0 _A_1... A_2_n - 1 A_2_n,  A_2_n =  _A_0, with sides of the exactly 1 meter in length.

Court rules for removing part of his property are as follows:

  • Split every edge A__k A__k + 1,  k = 0... 2_n_ - 1 in n equal parts of size 1 / n with points _P_0, _P_1, ..., P__n - 1
  • On every edge A_2_k A_2_k + 1,  k = 0... n - 1 court will choose one point B_2_k =  P__i for some i = 0, ...,  n - 1 such that
  • On every edge A_2_k + 1_A_2_k_ + 2,  k = 0...n - 1 Bill will choose one point B_2_k + 1 =  P__i for some i = 0, ...,  n - 1 such that
  • Bill gets to keep property inside of 2_n_-sided polygon _B_0 _B_1... B_2_n - 1

Luckily, Bill found out which B_2_k points the court chose. Even though he is a great mathematician, his house is very big and he has a hard time calculating. Therefore, he is asking you to help him choose points so he maximizes area of property he can keep.

比尔是泡泡国(BubbleLand)一位著名的数学家。得益于他革命性的数学发现,他赚到了足够的钱建造了一座美丽的房子。不幸的是,由于未能及时缴纳房产税,法院裁定对比尔进行处罚——剥夺他部分房产。

比尔的房产可视为一个凸正 2n2n 边形 A0A1…A2n−1A2nA_0 A_1 \dots A_{2n-1} A_{2n},其中 A2n=A0A_{2n} = A_0,且所有边长恰好为 11 米。

法院制定的房产剥夺规则如下:

  • 将每条边 AkAk+1A_k A_{k+1}(其中 k=0,1,…,2n−1k = 0, 1, \dots, 2n-1)等分为 nn 段,每段长度为 1n\frac{1}{n},分点记为 P0,P1,…,Pn−1P_0, P_1, \dots, P_{n-1};
  • 在每条边 A2kA2k+1A_{2k} A_{2k+1}(其中 k=0,1,…,n−1k = 0, 1, \dots, n-1)上,法院将选定一个点 B2k=PiB_{2k} = P_i(其中 i∈{0,1,…,n−1}i \in \{0, 1, \dots, n-1\}),满足条件:
  • 在每条边 A2k+1A2k+2A_{2k+1} A_{2k+2}(其中 k=0,1,…,n−1k = 0, 1, \dots, n-1)上,比尔将选定一个点 B2k+1=PiB_{2k+1} = P_i(其中 i∈{0,1,…,n−1}i \in \{0, 1, \dots, n-1\}),满足条件:
  • 比尔得以保有的房产,即为以 2n2n 边形 B0B1…B2n−1B_0 B_1 \dots B_{2n-1} 为边界的内部区域。

幸运的是,比尔已提前获知法院所选定的所有点 B2kB_{2k}。尽管他是一位杰出的数学家,但他的房子实在太大,难以手动完成相关计算。因此,他请求你帮助他选择各 B2k+1B_{2k+1} 点,以使他所能保留的房产面积最大化。

输入格式

The first line contains one integer number n (2 ≤ n ≤ 50000), representing number of edges of 2_n_-sided polygon.

The second line contains n distinct integer numbers B_2_k (0 ≤ B_2_k ≤ n - 1,  k = 0... n - 1) separated by a single space, representing points the court chose. If B_2_k = i, the court chose point P__i on side A_2_k A_2_k + 1.

第一行包含一个整数 $ n (( 2 \leq n \leq 50000 $),表示一个 $ 2n $ 边形的边数。

第二行包含 $ n $ 个互不相同的整数 $ B_{2k} (( 0 \leq B_{2k} \leq n - 1 $,其中 $ k = 0, \dots, n - 1 $),由单个空格分隔,表示法庭所选的点。若 $ B_{2k} = i $,则法庭在边 $ A_{2k}A_{2k+1} $ 上选择了点 $ P_i $。

输出格式

Output contains n distinct integers separated by a single space representing points _B_1, _B_3, ..., B_2_n - 1 Bill should choose in order to maximize the property area. If there are multiple solutions that maximize the area, return any of them.

输出包含 n 个互不相同的整数,以单个空格分隔,表示比尔应选择的点 _B_₁, _B_₃, ..., _B_₂ₙ ₋ ₁,以最大化地块面积。若存在多个能最大化面积的解,则返回其中任意一个即可。

输入输出样例

  • 输入#1

    3
    0 1 2

    输出#1

    0 2 1

说明/提示

To maximize area Bill should choose points: _B_1 = _P_0, _B_3 = _P_2, _B_5 = _P_1

为使面积最大,比尔应选择以下点:B1=P0B_1 = P_0,B3=P2B_3 = P_2,B5=P1B_5 = P_1

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

首页