BZOJ1768 : [Ceoi2009]logs

从上到下枚举行,可以$O(m)$更新现在每一列往上连续的1的个数,也可以在$O(m)$的时间内完成排序。总复杂度$O(nm)$。

#include<cstdio>
#define M 1510
int n,m,x,i,j,b[M],ans,q[2][M],t;char a[M];
int main(){
  for(scanf("%d%d",&n,&m),gets(a),i=1;i<=m;i++)q[0][i]=i;
  for(x=i=1;i<=n;i++,x^=1){
    gets(a+1);
    for(j=1;j<=m;j++)if(a[j]==‘1‘)b[j]++;else b[j]=0;
    for(t=0,j=1;j<=m;j++)if(b[q[x^1][j]])q[x][++t]=q[x^1][j];
    for(j=1;j<=m;j++)if(!b[q[x^1][j]])q[x][++t]=q[x^1][j];
    for(j=1;j<=m;j++)if(ans<j*b[q[x][j]])ans=j*b[q[x][j]];
  }
  return printf("%d",ans),0;
}

  

时间: 2024-09-30 16:54:33

BZOJ1768 : [Ceoi2009]logs的相关文章

解决Nginx: [error] open() "/usr/local/Nginx/logs/Nginx.pid

重新启动服务器,访问web服务发现无法浏览啦!登陆服务器之后进到nginx使用./nginx -s reload重新读取配置文件,发现报nginx: [error] open() "/usr/local/nginx/logs/nginx.pid" failed (2: No such file or directory)错误,进到logs文件发现的确没有nginx.pid文件 [[email protected] sbin]# ./nginx -s reload nginx: [err

【ESXI6.0】Vmware ESXI 6.0 【Customize System/View Logs】简介

Vmware ESXI 6.0 安装完毕后重启进入如下界面. 按F2进入系统设置与日志查询.会要求输入帐号密码.如下图 进入后界面如下图 Configure Password 修改密码简单不表.符合密码策略即可.至少7位,有字母数字. Configure Management Network 配置网络 回车进入后界面如下图 Network Adapters进入后可以查看网卡数量,如下图 VLan配置,暂时不太明白. 进IPv4 Configuration 配置IP地址,如下图. Configur

OPEN INFOREB SEARCH QUERY LOGSMATION EXTRACTION FROM WEB SEARCH QUERY LOGS

OPEN INFOREB SEARCH QUERY LOGSMATION EXTRACTION FROM WEB SEARCH QUERY LOGS 第一章  介绍 搜索引擎日益比传统的关键字输入.文档输出的先进,通过关注面向用户的任务提高用户体验,面向用户的任务包括查询建议.搜索个性化.推荐链接.这些以用户为中心的任务被从search query logs挖掘数据支撑.事实上,查询日志抓住用户对世界的认知,是这项应用的关键. 从查询日志中抽取的语言知识,如实体和关系,对上面的应用来说有很大的价

Apache服务启动失败couldn&#39;t start errorlog process, unable to open logs

在某用户环境下,Apache服务启动失败,报错信息如下 couldn't start errorlog process unable to open logs Apache是我们的产品组件,未防止日志过大 我们使用了Apache自带的切割滚存日志的组件rotatelogs.exe 在httpd.conf配置如下: ErrorLog "|bin/rotatelogs.exe logs/%Y%m%d%H%M%S_error.log 30M" 只要屏蔽这个设置,就可以正常启动Apache,谷

(error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about t

运行redis过程中,突然报错如下: (error) MISCONF Redis is configured to save RDB snapshots, but is currently not able to persist on disk. Commands that may modify the data set are disabled. Please check Redis logs for details about the error. 解决方案(百度到的答案,不过确实有用):

【翻译自mos文章】Standby Redo Logs (SRL)的用途,益处与限制

Standby Redo Logs (SRL)的用途,益处与限制 来源于: Usage, Benefits and Limitations of Standby Redo Logs (SRL) (文档 ID 219344.1) 目的: 本文显示了Standby Redo Logs (SRL)的用途,益处与限制,适用于 Oracle 9i/10g/11g中带有SRL的dataguard环境. 范围: 所有DBA以及希望实施9i/10g/11g (9.x-11.x) DataGuard的人 1. S

docker logs 实现剖析

Docker完全可以轻易构建用户的应用,即为 build: Docker还可以将应用快速分发,即为 ship: 最后,Docker依然有能力秒级启动应用,即为 run. Build,Ship,Run,简单的3步,分分钟为 DevOps 创建了管理应用生命周期的捷径. 应用是运行起来了,应用运行后,运行状态相信是工程师最关心的点.这一点,Docker如何帮工程师排忧解难呢? 想知道应用是否仍在运行?「docker ps」会告诉您. 想获知应用的资源使用情况如何?「docker stats」为您呈现

zookeeper logs is missing zookeeper 日志丢失

ERROR [main:[email protected]] - Invalid config, exiting abnormally Invalid config, exiting abnormally org.apache.zookeeper.server.quorum.QuorumPeerConfig$ConfigException: Error processing D:\Program Files\zookeeper-3.4.6\zookeeper-3.4.6\bin\..\conf\

Manage Spring Boot Logs with Elasticsearch, Logstash and Kibana

下载地址:https://www.elastic.co/downloads When time comes to deploy a new project, one often overlooked aspect is log management. ELK stack (Elasticsearch, Logstash, Kibana) is, among other things, a powerful and freely available log management solution.