// orchard folds mjd@cs.auckland.ac.nz // #include #include #include #include using namespace std; bool inBox(int x1, int y1, int x2, int y2, int x, int y) { if (x < x1 || x > x2) return false; if (y < y1 || y > y2) return false; return true; } bool fold3(const vector &x3, const vector &y3, int len) { for (int i=0; i &x2, const vector &y2, int len) { assert(x2.size()); vector x3, y3; int i; for (i=0; i &x2, const vector &y2, int len) { assert(x2.size()); int maxy = *max_element(y2.begin(),y2.end()); vector x3, y3; int i; for (i=0; i &x, const vector &y, int len) { vector x2, y2; int i; for (i=0; i &x, const vector &y, int len, int maxx) { vector x2, y2; int i; for (i=0; i &x, const vector &y, int len, int maxy) { vector x2, y2; int i; for (i=0; i &x, const vector &y, int len, int maxx, int maxy) { vector x2, y2; int i; for (i=0; i> s >> n; if (s==0 && n==0) break; vector x(n), y(n); int i; for (i=0; i> x[i] >> y[i]; if (n<=3) // trivial zero length boxes { cout << s << ' ' << 0 << endl; continue; } int minx = *min_element(x.begin(),x.end()); int miny = *min_element(y.begin(),y.end()); for (i=0; i