学习一发计算几何基础。
/* Telekinetic Forest Guard */
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <cmath>
using namespace std;
typedef double DB;
const int maxn = 50005;
const DB eps = 1e-6;
struct _line {
DB k, b;
int id;
} l[maxn];
int n, sta[maxn], top;
inline bool cmp(_line x, _line y) {
return fabs(x.k - y.k) < eps ? x.b < y.b : x.k < y.k;
}
inline bool cmp2(int x, int y) {
return l[x].id < l[y].id;
}
inline DB cosp(_line x, _line y) {
return (x.b - y.b) / (y.k - x.k);
}
inline void insert(int id) {
while(top) {
if(fabs(l[sta[top]].k - l[id].k) < eps) top--;
else if(top > 1 && cosp(l[id], l[sta[top - 1]]) <= cosp(l[sta[top]], l[sta[top - 1]])) top--;
else break;
}
sta[++top] = id;
}
int main() {
scanf("%d", &n);
for(int i = 1; i <= n; i++) scanf("%lf%lf", &l[i].k, &l[i].b), l[i].id = i;
sort(l + 1, l + 1 + n, cmp);
top = 0;
for(int i = 1; i <= n; i++) insert(i);
sort(sta + 1, sta + 1 + top, cmp2);
for(int i = 1; i <= top; i++) printf("%d ", l[sta[i]].id);
return 0;
}