Codeforces Gym 100002 C "Cricket Field" violence

Source: Internet
Author: User
Tags integer numbers

"Cricket Field"

Time Limit:1 Sec

Memory limit:256 MB

Topic Connection http://codeforces.com/gym/100002
Description

once upon a time there was a greedy king who ordered  his chief architect to build a field for royal cricket  inside his park. the king was so greedy, that he would  Not listen to his architect ' s proposals to build a field  right in the park center with pleasant patterns of trees  specially planted around and beautiful walks inside tree alleys  for spectators. instead, he ordered neither to cut nor to  plant even a single tree in his park, but demanded to  Build the largest possible cricket field for his pleasure. if  the kind finds that the architect has dared to touch even a single  tree in his park or designed a smaller field that it  Was possible, then the architect will loose his head. moreover,  he demanded his Architect to introduce at once a plan  Of the field with its exact location and size.

your task is to help poor architect to save his  head, by writing a program that will find the maximum  possible size of the cricket field and its location inside  The park to satisfy king ' s requirements.

The task is somewhat simplified by the fact, that king ' s  park has a rectangular shape and is situated on a flat  Ground. moreover, park ' s borders are perfectly aligned with  North-south and east-west lines. at the same time, royal cricket  is always played on a square field that is also  Aligned with north-south and east-west lines. architect has already  established a Cartesian coordinate system and has precisely  Measured the coordinates of every tree. this coordinate system is , of course, aligned with north-south and east-west lines.  Southwestern corner of the park has coordinates  (0, 0)  and northeastern corner of the  part has coordinates  (w, h),  where w and h are the  park width and height in feet respectively.

For this task, neglect the diameter of the trees. Trees cannot is inside the cricket field, but May is situated on its side. The cricket field may also touch park's border, but shall not lie outside the park.

Input

The first line of the input file contains three integer numbers N, W, and H, separated by spaces. N (0≤n≤100) is the number of trees in the park. W and H (1≤w, h≤10000) is the park width and height in feet respectively.

Next N Lines describe coordinates of trees in the park. Each line contains the numbers Xi and Yi separated by a space (0≤xi≤w, 0≤yi≤h) that represent coor Dinates of ith tree. All trees is located at different coordinates.

Output

Write to the output file a three integer numbers P, Q, and L separated by spaces, where (P, Q) is Coordi Nates of the cricket field southwestern Corner, and L are a length of its sides. If There is multiple possible field locations with a maximum size and then output any one.

Sample Input

7 10 7

3 2

4 2

7 0

7 3

4 5

2 4

1 7

Sample Output

4 3 4

HINT

Test instructions

Give you a NM area and ask you the largest square with no trees in the interior (there can be trees on the boundary)

Exercises

After reading the y-axis, the violent enumeration of the y-axis

Then count the squares in this area the maximum is how much

Code:

#include <iostream>#include<cstring>#include<cstdio>#include<algorithm>#include<cmath>#include<vector>#include<stack>#include<map>#include<Set>#include<queue>#include<iomanip>#include<string>#include<ctime>#include<list>#include<bitset>typedef unsignedChar byte;#definePB Push_back#defineInput_fast Std::ios::sync_with_stdio (false); Std::cin.tie (0)#defineLocal Freopen ("In.txt", "R", stdin)#definePi ACOs (-1)using namespacestd;Const intMAXN = 1e2 + the;intN, W, h, ansx =0, Ansy =0, ans =0;structpoint{intx, y; FriendBOOL operator< (ConstPoint & A,ConstPoint &b) {returna.x < b.x | | (a.x = = b.x && a.y<b.y); }};p oint p[maxn];vector<int>Line ;voidInitiation () {scanf ("%d%d%d",&n,&w,&h); Line.push_back (0);    Line.push_back (h);  for(inti =0; I < n; ++i) {scanf ("%d%d",&p[i].x,&p[i].y);    Line.push_back (P[I].Y); }}voidsolve () {sort (Line.begin (), Line.end ()); intc = Unique (Line.begin (), Line.end ())-Line.begin (); Sort (p, p+N);  for(inti =0; I < C; ++i) { for(intj = i +1; J < C; ++j) {intL =Line[i]; intR =Line[j]; intH = rm; intPre =0;  for(intK =0; K < n; ++k) {if(p[k].y >= R | | p[k].y <= L)Continue; inttx = p[k].x-Pre; intNewans =min (TX, h); if(Newans >ans) {ans=Newans; ANSX=Pre; Ansy=L; } Pre=p[k].x; }            inttx = W-Pre; intNewans =min (TX, h); if(Newans >ans) {ans=Newans; ANSX=Pre; Ansy=L; }}} printf ("%d%d%d\n", Ansx,ansy,ans);}intMainintargcChar*argv[]) {Freopen ("cricket.in","R", stdin); Freopen ("Cricket.out","W", stdout);    Initiation (); if(n = =0) printf ("0 0%d\n", Min (w,h)); Elsesolve (); return 0;}

Codeforces Gym 100002 C "Cricket Field" violence

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.