其实吧,就是一个半平面交,而且不用考虑转回来的情况,所以只要极角排序然后用栈即可
给的是点斜式,比极角很方便
至于完整版的半平面交还没写过,看到再说吧
var a,b,c,q:array[..] of longint;
v:array[..] of boolean;
t,i,n:longint;
procedure swap(var a,b:longint);
var c:longint;
begin
c:=a;
a:=b;
b:=c;
end; procedure sort(l,r: longint);
var i,j,x,y: longint;
begin
i:=l;
j:=r;
x:=a[(l+r) shr ];
y:=b[(l+r) shr ];
repeat
while (a[i]<x) or (a[i]=x) and (b[i]>y) do inc(i);
while (x<a[j]) or (a[j]=x) and (b[j]<y) do dec(j);
if not(i>j) then
begin
swap(a[i],a[j]);
swap(b[i],b[j]);
swap(c[i],c[j]);
inc(i);
j:=j-;
end;
until i>j;
if l<j then sort(l,j);
if i<r then sort(i,r);
end; procedure push(i:longint);
begin
while (t->) do
if ((b[q[t]]-b[i])/(a[i]-a[q[t]])<=(b[q[t]]-b[q[t-]])/(a[q[t-]]-a[q[t]])) then dec(t)
else break; //画图可知,如果栈内最后两条直线L2,L1的交点在新加入的直线的右侧,那么L1一定是不可见的
inc(t);
q[t]:=i;
end; begin
readln(n);
for i:= to n do
begin
readln(a[i],b[i]);
c[i]:=i;
end;
sort(,n);
push();
fillchar(v,sizeof(v),false);
for i:= to n do
if a[i]<>a[i-] then push(i);
for i:= to t do
v[c[q[i]]]:=true;
for i:= to n do
if v[i] then write(i,' ');
writeln;
end.