Codeforces Round #299 (Div. 1) C. Tavas and Pashmaks (convex hull)

Source: Internet
Author: User

C. Tavas and Pashmaks

Tavas is a cheerleader in the new sports competition named "Pashmaks".

This competition consists of the part:swimming and then running. People would immediately start running R meters after they finished swimming exactly S meters. A winner is a such person, that nobody else finishes running before him/her (there could be more than one winner).

Before the match starts, Tavas knows that there Are  n  competitors Registered for the match. Also, he knows That  i -th person's swimming speed is  s I  meters per second and his/her running speed Is  R I  meters per second. Unfortunately, he doesn ' t know the values Of  R  and  S , but he knows that they is real numbers greater Than 0.

As a cheerleader, Tavas wants to know. So, he wants to know all people that might win. We consider a competitor might win if and only if there is some values of R and S such that wit H these values, (s) he'll be a winner.

Tavas isn ' t really familiar with programming, so he asked your to help him.

Input

The first line of input contains a single integer n (1≤ n ≤2x105).

The next n lines contain the details of the competitors.  I-th line contains II integers si and Ri (1≤ s i, rI ≤104).

Output

In the first and the only line of output, print a sequence of numbers of possible winners in increasing order.

Sample Test (s) input
3
1 3
2 2
3 1
Output
Input
3
1 2
1 1
2 1
Output


Test instructions: N individual competitions, swimming and racing, swimming distance s, running R. Each person corresponds to two speed (land and water), if present S, R, makes the first I personal victory, then output I.
Topic Requirement: Output all I.

The reciprocal of Ri Si can be regarded as the point of coordinate system, and time can be used as the dot product of two vectors, which is projection ...
Find the convex hull. P1 is the bottom point if there is more than one selection of the leftmost one, the leftmost point of the P2 bit if there are more than one selection of the bottom one. Then the point on the convex hull from P1 to P2 must satisfy the test instructions. Pay attention to the weight
1#include <bits/stdc++.h>2 using namespacestd;3 Const DoubleEPS = 1e- -;4 Const intINF =0x3f3f3f3f;5 struct Point6 {7     Doublex, y;8     intidx;9Point (Doublex =0,Doubley =0):Ten x (x), Y (y) {} One     BOOL operator== (ConstPoint &AMP;RHS)Const A     { -         returnABS (X-rhs.x) < EPS && (Y-RHS.Y) <EPS; -     } the     BOOL operator< (ConstPoint &AMP;RHS)Const -     { -         returnX < Rhs.x | | (ABS (X-rhs.x) < EPS && y <rhs. Y); -     } + }; - typedef point Vector; +Vectoroperator-(Point P1, point p2) A { at     returnVector (p1.x-p2.x, p1.y-p2.y); - } - DoubleCross (vector p1, vector p2) - { -     returnp1.x*p2.y-p2.x*p1.y; - } inPoint p[200010], cvx[200010]; - BOOLans[200010]; to intpos[200010]; + BOOLcmpDoublex) - { the     returnX <0|| ABS (x) <EPS; * } $ intConvexhull (intN)Panax Notoginseng { -Sort (p, p+n); the     //n = unique (p, p+n)-p; +     inttot =0; A      for(inti =0; I < n; i++) the     { +         if(I >0&& P[i] = = p[i-1]) -         { $Pos[i] = pos[i-1]; $             Continue; -         } -Pos[i] =i; the          while(Tot >1&& CMP (Cross (cvx[tot-1]-cvx[tot-2], p[i]-cvx[tot-2])) ==true) -tot--;Wuyicvx[tot++] =P[i]; the     } -     intK =tot; Wu      for(inti = n2; I >=0; i--) -     { About          while(Tot > K && cmp (Cross (cvx[tot-1]-cvx[tot-2],p[i]-cvx[tot-2]) ==true)) $tot--; -cvx[tot++] =P[i]; -     } -     if(N >1) Atot--; +     returntot; the } - BOOLCMP2 (ConstPoint &p1,ConstPoint &p2) $ { the     returnP1.y < P2.Y | | (ABS (P1.Y-P2.Y) < EPS && p1.x <p2.x); the } the intMainvoid) the { - #ifndef Online_judge inFreopen ("In.txt","R", stdin); the #endif //Online_judge the     intN; About      while(~SCANF ("%d", &N)) the     { thememset (ans,false,sizeof(ans)); thememset (POS,0,sizeof(POS)); +         DoubleMINV1 = inf, minv2 =inf; -          for(inti =0; I < n; i++) the         {Bayi             Doubles, R; thescanf ("%LF%LF", &s, &R); theminv1 = min (1000000/R, MINV1);//Reduce Error -minv2 = min (Minv2,1000000/s); -P[i] = Point (1000000/S,1000000/R); theP[i].idx =i; the         } the         inttot =convexhull (n); the          for(inti =0; i < tot; i++) -         { theANS[CVX[I].IDX] =true; the             if(ABS (CVX[I].Y-MINV1) <EPS) the                  Break;94         } the          for(inti =0; I < n; i++) the         { the             if(Ans[p[pos[i]].idx] = =true)98ANS[P[I].IDX] =true; About         } -          for(inti =0; I < n; i++)101             if(Ans[i] = =true)102printf"%d", i+1);103printf"\ n");104  the     }106 107     return 0;108}

Codeforces Round #299 (Div. 1) C. Tavas and Pashmaks (convex hull)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.