#include #include #include #include #include #include #include #include #include using namespace std; #define SIZE(s) int((s).size()) #define REP(i,n) for (int i=0; i<(n); i++) int N; int X[20], Y[20], V[20], L[20]; typedef complex point; point ZERO(0); double dist(const point &a, const point &b) { return hypot( real(a)-real(b), imag(a)-imag(b) ); } double cross_product(const point &a, const point &b) { return real(a)*imag(b) - real(b)*imag(a); } bool countercw(const point &a, const point &b, const point &c) { return cross_product( b-a, c-a ) > 1e-7; } int signum(double d) { if (d<-1e-7) return -1; if (d>1e-7) return 1; return 0; } bool compare_arg(const point &a, const point &b) { if (dist(b,ZERO)<1e-7) return false; if (dist(a,ZERO)<1e-7) return true; int sgnA = signum(imag(a)), sgnB = signum(imag(b)); if (sgnA == 0) if (signum(real(a))<0) sgnA = 2; if (sgnB == 0) if (signum(real(b))<0) sgnB = 2; if (sgnA != sgnB) return sgnA < sgnB; if (countercw(ZERO,a,b)) return true; if (countercw(ZERO,b,a)) return false; return dist(ZERO,a) < dist(ZERO,b); } double convex_hull(int ostalo) { vector< complex > body; REP(i,N) if (ostalo & (1< hull(K+2); hull[0]=0; hull[1]=1; for (int i=2; i= 2 && !countercw( body[hull[count-2]], body[hull[count-1]], body[i] )) count--; hull[ count++ ] = i; } double res = 0; for (int i=0; i= dlzka - 1e-9) best = min(best,cena); } printf("The lost value is %d.\n",best); } }