1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| const int maxn = 100 + 4;
class Point { public: int x, y; bool operator< (const Point& rhs) const { if(x != rhs.x) return x < rhs.x; return y < rhs.y; } };
Point P[maxn]; int dy[maxn]; int ans, ansX, ansY;
void init() { Set(dy, 0); ans = ansX = ansY = 0; }
int N, W, H;
void solve() { int n = unique(dy, dy + N + 2) - dy; _for(i, 0, n) _for(j, i + 1, n) { int minY = dy[i], maxY = dy[j]; int hh = maxY - minY, last = 0, ww = 0;
_for(k, 0, N) { Point& cur = P[k]; if(cur.y <= minY || cur.y >= maxY) continue;
ww = cur.x - last; if(ans < min(ww, hh)) { ans = min(ww, hh); ansX = last, ansY = minY; } last = cur.x; }
ww = W - last; if(ans < min(ww, hh)) { ans = min(ww, hh); ansX = last, ansY = minY; } } printf("%d %d %d\n", ansX, ansY, ans); }
int main() { freopen("input.txt", "r", stdin); int T; scanf("%d", &T);
while (T--) { init(); scanf("%d%d%d", &N, &W, &H);
_for(i, 0, N) { scanf("%d%d", &P[i].x, &P[i].y); dy[i] = P[i].y; } dy[N] = 0, dy[N + 1] = H;
// discrete sort(dy, dy + N + 2); sort(P, P + N);
solve(); if(T) printf("\n"); } }
|