bzoj1768: [Ceoi2009]logs
来源:互联网 发布:java泛型里的? 编辑:程序博客网 时间:2024/06/11 18:38
传送门
显然我们可以一行一行做。
然后求出每列向上连续1的个数。
然后单调队列随便水过。
#include<cmath>#include<cstdio>#include<cstdlib>#include<cstring>#include<iostream>#include<algorithm>using namespace std;char s[1505];int f[2][1505],id[2][1505];int n,m,h,t,ans,c;int main(){ scanf("%d%d",&n,&m); for (int i=1;i<=m;++i) id[0][i]=i; for (int i=1;i<=n;++i){ scanf("%s",s+1); h=0,t=m+1; c^=1; for (int j=1;j<=m;++j) if (s[id[c^1][j]]=='0'){ f[c][--t]=0; id[c][t]=id[c^1][j]; } else{ f[c][++h]=f[c^1][j]+1; id[c][h]=id[c^1][j]; } for (int j=1;f[c][j];++j) ans=max(ans,f[c][j]*j); } printf("%d\n",ans);}
阅读全文
0 0
- bzoj1768: [Ceoi2009]logs
- bzoj 1768: [Ceoi2009]logs
- logs
- 【网络流】CEOI2009 all
- bzoj1766: [Ceoi2009]photo
- Deleting Logs
- old logs
- 错误logs
- TMG logs
- BFILEs & LOGs
- project logs
- mysql logs
- docker logs
- Managing Archived Redo Logs
- Troubleshooting with Postfix Logs
- iPhone Crash Logs
- Logs in Android
- shelll study logs
- HDU3746--KMP+最小循环节
- 编译 链接和加载
- c++ 11 特性随笔
- 文章标题
- java语言基础-引出数组和数组定义
- bzoj1768: [Ceoi2009]logs
- HDU 5533 Dancing Stars on Me 计算几何瞎暴力
- ListView列表控件的介绍和性能优化
- CSDN机器学习笔记三 决策树、随机森林
- 使用Qt+PySide将UI文件转化为py文件
- List 自定义排序
- java基础
- hdoj 1017-A Mathematical Curiosity
- 2017.06.08