博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
P1578 奶牛浴场 有障碍点的最大子矩形
阅读量:4502 次
发布时间:2019-06-08

本文共 1693 字,大约阅读时间需要 5 分钟。

这题咕咕了很久终于写了\(QwQ\)


思路:扫?

提交:2次

错因:数据差评,第一次把矩形的长宽搞反了竟然只有一个点没有\(A\)

题解:

显然能成为答案的矩形的边界一定有障碍点或者与大矩形边界重合。

细节见代码(及注释)

#include
#include
#include
#define ull unsigned long long#define ll long long#define R register intusing namespace std;#define pause (for(R i=1;i<=10000000000;++i))#define In freopen("NOIPAK++.in","r",stdin)#define Out freopen("out.out","w",stdout)namespace Fread {static char B[1<<15],*S=B,*D=B;#ifndef JACK#define getchar() (S==D&&(D=(S=B)+fread(B,1,1<<15,stdin),S==D)?EOF:*S++)#endifinline int g() { R ret=0,fix=1; register char ch; while(!isdigit(ch=getchar())) fix=ch=='-'?-1:fix; if(ch==EOF) return EOF; do ret=ret*10+(ch^48); while(isdigit(ch=getchar())); return ret*fix;} inline bool isempty(const char& ch) {return (ch<=36||ch>=127);}inline void gs(char* s) { register char ch; while(isempty(ch=getchar())); do *s++=ch; while(!isempty(ch=getchar()));}} using Fread::g; using Fread::gs;namespace Luitaryi {const int N=5010;struct node { int x,y; inline bool operator <(const node& that) const {return x==that.x?y
(const node& that) const {return y==that.y?x
w*(up-dn)) break;//一个小剪枝 ans=max(ans,(a[j].x-a[i].x)*(up-dn)); if(a[i].y==a[j].y) break;//同样高度就不必向右继续扫描 //(此时矩形已经成为了一条线了,但就算你不把它看成线,过这条线且以a[i]为左边界的子矩形也一定不优(可以往左扩)) if(a[i].y
a[j].y) dn=max(a[j].y,dn); } up=m,dn=0,w=a[i].x; for(R j=i-1;j;--j) { if(ans>w*(up-dn)) break; ans=max(ans,(a[i].x-a[j].x)*(up-dn)); if(a[i].y==a[j].y) break; if(a[i].y
a[j].y) dn=max(a[j].y,dn); } }//此时已经处理完正常情况和与大矩形上下边界重合的情况 sort(a+1,a+cnt+1,greater
());//按纵坐标排序 for(R i=1;i

2019.07.23

转载于:https://www.cnblogs.com/Jackpei/p/11232213.html

你可能感兴趣的文章
As3 Socket高低位
查看>>
15. 三数之和
查看>>
使用angular.js获取form表单中的信息
查看>>
TestNG
查看>>
高精——模板
查看>>
生成CFree 5.0 注册码
查看>>
磁力链接
查看>>
【问题解决方案】之 关于某江加密视频swf专用播放器仍无法播放的问题
查看>>
2014,码农梦想,先从态度开始!
查看>>
常用板子
查看>>
linux中安装eclipse--CnetOS6.5
查看>>
应用层拒绝服务攻击
查看>>
JavaScript学习总结(五)——jQuery插件开发与发布
查看>>
广度优先(迷宫找人)
查看>>
word2vec 评测 window_different
查看>>
我觉得二专很OK-2
查看>>
poj 2777
查看>>
最新版本GIT安装
查看>>
Python微信
查看>>
Oracle 存储过程起步
查看>>