CF852C.Property

普及/提高-

通过率:0%

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 2n2n -sided polygon A0 A1... A2n1 A2n, A2n= A0A_{0}\ A_{1}...\ A_{2n-1}\ A_{2n},\ A_{2n}=\ 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 Ak Ak+1, k=0... 2n1A_{k}\ A_{k+1},\ k=0...\ 2n-1 in nn equal parts of size 1/n1/n with points P0,P1,...,Pn1P_{0},P_{1},...,P_{n-1}
  • On every edge A2k A2k+1, k=0... n1A_{2k}\ A_{2k+1},\ k=0...\ n-1 court will choose one point B2k= PiB_{2k}=\ P_{i} for some i=0,..., n1i=0,...,\ n-1 such that
  • On every edge A2k+1A2k+2, k=0...n1A_{2k+1}A_{2k+2},\ k=0...n-1 Bill will choose one point B2k+1= PiB_{2k+1}=\ P_{i} for some i=0,..., n1i=0,...,\ n-1 such that
  • Bill gets to keep property inside of 2n2n -sided polygon B0 B1... B2n1B_{0}\ B_{1}...\ B_{2n-1}

Luckily, Bill found out which B2kB_{2k} 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.

输入格式

The first line contains one integer number n (2<=n<=50000)n\ (2<=n<=50000) , representing number of edges of 2n2n -sided polygon.

The second line contains nn distinct integer numbers B2k (0<=B2k<=n1, k=0... n1)B_{2k}\ (0<=B_{2k}<=n-1,\ k=0...\ n-1) separated by a single space, representing points the court chose. If B2k=iB_{2k}=i , the court chose point PiP_{i} on side A2k A2k+1A_{2k}\ A_{2k+1} .

输出格式

Output contains nn distinct integers separated by a single space representing points B1,B3,...,B2n1B_{1},B_{3},...,B_{2n-1} Bill should choose in order to maximize the property area. If there are multiple solutions that maximize the area, return any of them.

输入输出样例

  • 输入#1

    3
    0 1 2
    

    输出#1

    0 2 1
    

说明/提示

To maximize area Bill should choose points: B1=P0B_{1}=P_{0} , B3=P2B_{3}=P_{2} , B5=P1B_{5}=P_{1}

首页