Just start to see this topic do not know what east, after looking at the problem of the big God to know is the stability convex hull, what is stable convex package? The so-called stability is to determine whether the original convex hull can be dotted, a larger convex hull, and the convex package contains all the points on the original convex hull. Know this thing is simple, directly out of the convex hull, and then determine whether the point on each edge is more than three points on the line.
The code is as follows:
=============================================================================================================== =============
#include <stdio.h>#include<string.h>#include<algorithm>#include<math.h>using namespacestd;Const DoubleEPS = 1e- -;Const intMAXN =1007;Const intOO = 1e9+7;intSTA[MAXN], top;structpoint{Doublex, y; Point (Doublex=0,Doubley=0): X (x), Y (y) {} pointoperator- (ConstPoint &t)Const{ returnPoint (X-t.x, yt.y); } Double operator*(ConstPoint &t)Const{ returnX*t.x + y*T.y; } Double operator^(ConstPoint &t)Const{ returnx*t.y-y*T.x; }}P[MAXN];intSign (Doublet) { if(T > EPS)return 1; if(Fabs (T) < EPS)return 0; return-1;}DoubleDist (Point A, point B) {returnsqrt (A-B) * (Ab));}BOOLCMP (Point A, point B) {intt = sign (a-p[0]) ^ (b-p[0])); if(T = =0) returnDist (A, p[0]) < Dist (b, p[0]); returnT >0;}voidGraham (intN) { intk=0; for(intI=0; i<n; i++) { if(P[k].y>p[i].y | | (sign (p[k].y-p[i].y) = =0&& p[k].x >p[i].x)) K=i; } Swap (p[0], p[k]); Sort (P+1, p+N, CMP); sta[0]=0, sta[1]=1, top=1; if(N <2) {Top= N1; return ; } for(intI=2; i<n; i++) { while(top>0&& sign ((P[i]-p[sta[top]) ^ (p[sta[top-1]]-p[sta[top]]) <=0) Top--; sta[++top] =i; }}intMain () {intT, N, I, J; scanf ("%d", &T); while(t--) {scanf ("%d", &N); for(i=0; i<n; i++) scanf ("%LF%LF", &p[i].x, &p[i].y); Graham (N); sta[++top] = sta[0]; for(i=0; i<top; i++) { intS=sta[i], e=sta[i+1]; for(j=0; j<n; J + +) { if(J==s | | j==e)Continue; if(sign (p[s]-p[e) ^ (P[j]-p[e]) = =0) Break; } if(J = =N) Break; } if(I < top | | Top <3) printf ("no\n"); Elseprintf ("yes\n"); } return 0;}
Grandpa ' s Estate-poj 1228 (Stable convex bag)