1

include

include

include

using namespace std;

struct my{
double x,y;
};

const int maxn=1000000+10;
int n;
my a[maxn];
int b[maxn];
int ans[maxn];

int read()
{
char ch=' ';int x=0,y=1;
for(;(ch!='-')&&((ch<'0')||(ch>'9'));ch=getchar());
if(ch=='-')y=-1,ch=getchar();
for(;ch>='0' && ch<='9';ch=getchar())x=x10+ch-48;
x=x
y;
return x;
}

void solve1(){
for (int i=1;i<=n;i++) b[i]=i;
for (int i=1;i<=n;i++){
ans[i]=b[i];
if(b[i]!=i) {
int xx=b[i];
for (int j=i+1;j<=n;j++){
if((double)a[j].y<(double)(a[j].x-a[i].x)*(a[xx].y-a[i].y)/(a[xx].x-a[i].x)+a[i].y)
b[j]=i;
}
}else {
for (int j=i+1;j<=n;j++){
if(a[j].y<a[i].y) b[j]=i;
}
}
}
for (int i=1;i<=n;i++) printf("%d\n",ans[i]);
}

int main(){
n=read();
for (int i=1;i<=n;i++) a[i].x=read(),a[i].y=read();
solve1();
return 0;
}

posted @ 2018-11-04 11:20  lmjer  阅读(139)  评论(0编辑  收藏  举报