住房城乡与建设厅网站首页,企业服务网站开发,潮阳发布最新通告,自动评论插件wordpress题意#xff1a;在w*h的方格内#xff0c;找出一个最大的正方形#xff0c;使得正方形内没有点#xff08;可以在边界有点#xff09;。 思路#xff1a;枚举。正方形可以看作是矩形#xff0c;只不过在取的时候取最短的那条边作为边长#xff0c;那么枚举出短边最大的…题意在w*h的方格内找出一个最大的正方形使得正方形内没有点可以在边界有点。 思路枚举。正方形可以看作是矩形只不过在取的时候取最短的那条边作为边长那么枚举出短边最大的矩形即可。 code #include iostream
#include cstdio
#include cmath
#include algorithm
#include cstring
#include sstream
#include string
#include vector
#include list
#include queue
#include stack
#include map
#include set
#include bitsetusing namespace std;typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;const int INF0x3fffffff;
const int inf-INF;
const int N1000000;
const int M105;
const int mod1000000007;
const double piacos(-1.0);#define cls(x,c) memset(x,c,sizeof(x))
#define cpy(x,a) memcpy(x,a,sizeof(a))
#define fr(i,s,n) for (int is;in;i)
#define lson l,m,rt1
#define rson m1,r,rt1|1
#define lrt rt1
#define rrt rt1|1
#define middle int m(rl)1
#define lowbit(x) (x-x)
#define pii pairint,int
#define mk make_pair
#define IN freopen(in.txt,r,stdin);
#define OUT freopen(out.txt,w,stdout);struct node
{int x,y;
}g[M];
int y[M];bool cmp(node a,node b)
{if (a.xb.x) return a.yb.y;return a.xb.x;
}
int main()
{int T,n,w,h;scanf(%d,T);while (T--){scanf(%d %d %d,n,w,h);fr(i,0,n-1){scanf(%d %d,g[i].x,g[i].y);y[i]g[i].y;}y[n]0;y[n1]h;sort(y,yn2);sort(g,gn,cmp);int ans0,sx,sy;int munique(y,yn2)-y;fr(i,0,m-1) for (int ji1;jm;j){int thy[j]-y[i],p0,tw;fr(k,0,n-1){if (g[k].yy[i]||g[k].yy[j]) continue;twg[k].x-p;if (ansmin(th,tw)){ansmin(th,tw);sxp;syy[i];}pg[k].x;}tww-p;if (ansmin(th,tw)){ansmin(th,tw);sxp;syy[i];}}printf(%d %d %d\n,sx,sy,ans);if (T) puts();}
}