BZOJ3428 [Usaco2014 Jan]Cow Curling
补昨天的题。 比较好想的计算几何。就看每个点在不在另一个颜色的点形成的上凸壳下面,下凸壳上面。这个用二分可以做到单次log。用单调应该也能O(n)。 但是写起来非常坑,要用long long,还有各种等号啥的。 写win32 app来显示点的代码比交上去的代码还长。开心。 #include <cstdio> #include <algorithm> usingnamespacestd; typedeflonglongqw; #define _l (qw) structpoint { intx, y; point (intx0 = 0, inty0 = 0) { x = x0, y = y0; } inlinevoidread() { scanf("%d%d", &x, &y); } }; structvect { intx, y; vect(intx0 = 0, inty0 = 0) { x = x0, y = y0; } vect(constpoint& a, constpoint& b) {...