当前位置: 首页 > news >正文

网站对于一个企业的优势织梦本地网站建设教程

网站对于一个企业的优势,织梦本地网站建设教程,重庆景点,网络营销外包公司的评价https://www.luogu.org/problemnew/show/P1169 第一次听说到这种dp的名称叫做悬线法#xff0c;听起来好厉害 题意是求一个矩阵内的最大01交错子矩阵#xff0c;开始想的是dp[2000][2000][2]维护这个位置向上向左扩充的矩阵最大长度之后n扫一遍#xff0c;但是写起来发现并不… https://www.luogu.org/problemnew/show/P1169   第一次听说到这种dp的名称叫做悬线法听起来好厉害 题意是求一个矩阵内的最大01交错子矩阵开始想的是dp[2000][2000][2]维护这个位置向上向左扩充的矩阵最大长度之后n²扫一遍但是写起来发现并不能有效的扩充也就是状态转移方程很难写出来。 后来发现有一种奥妙重重的方法叫做悬线法把我原本向左向上扩充的过程改为记录每一个点向左向右向上的最大长度这些状态很显然可以通过扫一遍的方法求出来然后对于每一个点宽度就是l - r 1显然对于同一个合法区间内的点他的left和right是相同的。 用自上而下的方法递推出到N这一行时这个点向上扩充的最大长度之后递推即可。 悬线法对一类限制下求子矩阵的问题很好用。 #include map #include set #include ctime #include cmath #include queue #include stack #include vector #include string #include cstdio #include cstdlib #include cstring #include sstream #include iostream #include algorithm #include functional using namespace std; inline int read(){int now0;register char cgetchar();for(;!isdigit(c);cgetchar()); for(;isdigit(c);nownow*10c-0,cgetchar());return now;} #define For(i, x, y) for(int ix;iy;i) #define _For(i, x, y) for(int ix;iy;i--) #define Mem(f, x) memset(f,x,sizeof(f)) #define Sca(x) scanf(%d, x) #define Sca2(x,y) scanf(%d%d,x,y) #define Sca3(x,y,z) scanf(%d%d%d,x,y,z) #define Scl(x) scanf(%lld,x); #define Pri(x) printf(%d\n, x) #define Prl(x) printf(%lld\n,x); #define CLR(u) for(int i0;iN;i)u[i].clear(); #define LL long long #define ULL unsigned long long #define mp make_pair #define PII pairint,int #define PIL pairint,long long #define PLL pairlong long,long long #define pb push_back #define fi first #define se second typedef vectorint VI; const double eps 1e-9; const int maxn 2010; const int INF 0x3f3f3f3f; const int mod 1e9 7; int N,M,K; int Left[maxn][maxn],Right[maxn][maxn],up[maxn][maxn]; int MAP[maxn][maxn]; int main() {Sca2(N,M);for(int i 1; i N ; i ){for(int j 1; j M ; j ){Sca(MAP[i][j]);Left[i][j] Right[i][j] j;up[i][j] 1;}}for(int i 1; i N ; i ){for(int j 2; j M ; j ){if(MAP[i][j] ! MAP[i][j - 1]){Left[i][j] Left[i][j - 1];}}for(int j M - 1; j 1; j --){if(MAP[i][j] ! MAP[i][j 1]){Right[i][j] Right[i][j 1];}}}int ans1 0,ans2 0;for(int i 1; i N ; i ){for(int j 1; j M ; j ){if(i 1 MAP[i][j] ! MAP[i - 1][j]){Left[i][j] max(Left[i][j],Left[i - 1][j]);Right[i][j] min(Right[i][j],Right[i - 1][j]);up[i][j] up[i - 1][j] 1;}int a Right[i][j] - Left[i][j] 1;int b min(a,up[i][j]);ans1 max(ans1,b * b);ans2 max(ans2,a * up[i][j]);}}Pri(ans1);Pri(ans2);return 0; }  转载于:https://www.cnblogs.com/Hugh-Locke/p/10261871.html
http://www.yutouwan.com/news/196619/

相关文章:

  • 指数 网站权重承德专业做网站
  • 设计公司网站要包含什么信息柯桥网站建设
  • 佛山网站建设78788金华金东区建设局网站
  • 福州网站制作公司名字高校信息化建设网站系统微信
  • 网站建设流程表网站开发 软文
  • 苏州国内网站建设公司连运港网络公司做网站
  • 欧泰国际物流网站wordpress+下载受限
  • 一般做外贸上什么网站好有没有专门做团购的网站
  • 域名后缀html是怎样的网站株洲市
  • 成品网站w灬源码火龙果公司网站设计注意事项
  • 长沙seo网站管理网页设计可以进怎样的公司
  • vs2017 如何做网站农业展示网站模板下载
  • wordpress网站非常慢品牌广告语经典100条
  • 杭州品牌网站建设招标文件范本
  • 北京 外贸网站网站改版汇报
  • 徐州企业自助建站企业如何全面开展品牌工程建设
  • 京美建站官网网站宝 西部数码网站管理助手
  • 重庆医院网站建设thinkphp做的网站怎么预览
  • 网站历史快照网站建设和网络营销区别
  • 重庆网站设计公司网站制作中山品牌网站设计
  • 临沂营销型网站建设公司常见八大职能部门
  • 做网站的开发软件是什么郑州网站高端网站设计
  • 海派虫网站推广软件wordpress模板使用
  • 量子秘密网站怎么做成都最新新闻事件今天
  • 北京专业的做网站适合个人做的网站有哪些东西吗
  • 网站建设需要代码网站建设方案对比分析
  • 提供网站建设备案报价做网站什么时候注册商标
  • 建设网站群的好处wordpress标签墙
  • wordpress如何做站群章丘网站定制
  • 怎么做类似淘宝一样的网站毕业设计网站建设选题依据