【codeforces】Ohana Cleans Up

边表法 边表法是用来绘制填充一个面的,边表法的关键是边表和连接边表的扫描线。 对于边的描述利用边表数据结构,包含边与扫描线的交点x坐标,边的最大y坐标,这样可以知道边加入到哪些扫描线上,便还有一个指针来记录扫描线上其它边。 //边数据结构 #pragma once #ifndef __CAETZ__ #define __CAETZ__ #include "pch.h" #include "CPoin... 阅读详情

B. Ohana Cleans Up
time limit per test
2 seconds
memory limit per test
256 megabytes
input
standard input
output
standard output

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom is very strange: if she sweeps over a clean square, it will become dirty, and if she sweeps over a dirty square, it will become clean. She wants to sweep some columns of the room to maximize the number of rows that are completely clean. It is not allowed to sweep over the part of the column, Ohana can only sweep the whole column.

Return the maximum number of rows that she can make completely clean.

Input

The first line of input will be a single integer n (1 ≤ n ≤ 100).

The next n lines will describe the state of the room. The i-th line will contain a binary string with n characters denoting the state of the i-th row of the room. The j-th character on this line is '1' if the j-th square in the i-th row is clean, and '0' if it is dirty.

Output

The output should be a single line containing an integer equal to a maximum possible number of rows that are completely clean.

Examples
input
4
0101
1000
1111
0101
output
2
input
3
111
111
111
output
3
Note

In the first sample, Ohana can sweep the 1st and 3rd columns. This will make the 1st and 4th row be completely clean.

In the second sample, everything is already clean, so Ohana doesn't need to do anything.


求出由相同纵序列的个数,与全部都是1的行数比较,大者就是答案。

#include<cstdio>
#include<iostream>
#include<cstring>
#include<cmath>
#include<algorithm>
using namespace std;
const int N = 105;
char map[N][N];
int main() {
	int n;
	while(scanf("%d",&n)!=EOF) {
		int flag=0,sum=0;
		for(int i=0; i<n; i++) {
			scanf("%s",map[i]);
			for(int j=0; j<n; j++) {
				if(map[i][j]=='0')
					flag=1;
			}
			if(!flag) {
				sum++;
			}
		}
		int num,cnt=0;
		for(int i=0; i<n; i++) {
			num=0;
			for(int j=0; j<n; j++) {
				if(i==j)
					continue;
				else {
					if(strcmp(map[i],map[j])==0) {
						num++;
					}
				}
			}
			cnt=max(cnt,num);
		}
		printf("%d\n",max(cnt+1,sum));
	}
	return 0;
}

题目地址:http://codeforces.com/problemset/problem/554/B




E-Prime脑电实验打mark全攻略:从端口查询到串并口实战(附常见问题解决) 本文提供了E-Prime脑电实验打mark的完整实战指南,涵盖端口查询、并口与串口配置的核心步骤及常见问题解决。文章深入解析了mark原理,并详细介绍了通过E-Basic脚本和Serial设备对象发送信号的两种方法,帮助研究者实现E-Prime与脑电设备的高精度时间同步,确保实验数据可靠性。 阅读详情

相关推荐

主动式桥梁防船撞预警系统的方案汇总

本系统以精密光电测高前端(2台,上下游各1台)、固态雷达(2台,上下游各1台)、AIS(1台)、偏航辅助前端(4台,上下游各2台)为核心,通过人工智能,对画面上的船舶目标进行深度学习、精确定位,再用系统集成方法将各设备有机结合在一起,构建成套的桥梁防撞主动预警系统,全天候监控过往船舶。主动式桥梁防船撞预警系统主要船舶监测采集单元、控制单元、船舶超高、偏航信息检测单元、以及视频监控单元组成,,通过声光警示、短信文字、船舶身份识别及海事对讲频道、视频录像取证等多种手段与船舶进行信息互动,主动防止船舶碰撞桥梁!

gdxixun的博客 990

B. Ohana Cleans Up

time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ohana Matsumae is trying to clean a room, which is divided up in

无知的我 1052

SillyTavern 向量存储配置踩坑记:从卡死到本地部署 Ollama 跑通

用此命令看到镜像就算成功。

qq_62483451的博客 1282

CF554B水题一发,求最大字符串相等的行

#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; #define LL long long int m

ONE_PIECE的专栏 643

从7V到28V宽压输入,手把手教你设计一个5V/3A的DCDC电源模块(附MPS1584选型与原理图避坑)

本文详细解析了基于MPS1584芯片的7V至28V宽压输入到5V/3A输出的DCDC电源模块设计全流程。从电源架构选择、原理图设计要点到实际调试经验,涵盖了输入保护电路、功率转换核心电路及系统级优化测试,帮助工程师规避常见设计陷阱,实现高效稳定的电源解决方案。

weixin_33712987的博客 515

CLion与STM32CubeMX联调:JLink GDB Server高效调试指南

本文详细介绍了如何搭建并配置CLion、STM32CubeMX与JLink GDB Server联调的现代化STM32开发环境。通过一站式环境搭建、工程创建、核心调试配置及高级技巧(如RTT日志),该组合实现了高效的代码编辑、可视化配置与稳定调试,大幅提升嵌入式开发效率与体验。

web99的专栏 258

B. Ohana Cleans Up(Codeforces Round #309 (Div. 2))

B. Ohana Cleans Up   Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom

寻找&星空の孩子 1124

万字长文,YOLOv8 yaml 文件解析 | 一文搞定 YOLOv8 分类任务,检测任务,分割任务,关键点任务

YOLOv8 yaml 文件解析 | 一文搞定 YOLOv8 分类任务,检测任务,分割任务,关键点任务

Coding... 1万+

Codeforces 554B Ohana Cleans Up

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her

XDU_PYL的博客 539

openclaw通俗入门系列6——记忆系统

记忆 = 智能体的笔记本,分长期(MEMORY.md)和每日(memory/日期.md)。只有写到文件里的才能记住!支持语义搜索(理解意思)+ 关键词搜索,还能自动在压缩前保存重要内容。

m0_60605453的博客 404

Windows部署OpenClaw报错不断?这篇环境配置指南帮你解决难题

想在Windows上部署OpenClaw却频频报错?🔧 本文详细梳理了OpenClaw部署必需环境的安装步骤和官方下载地址 📦,提供完整的验证清单和常见问题排查方法,帮你一次性搞定所有环境配置,顺利部署OpenClaw ✅

XiaoqiangClub的博客 6663

codeforces 554B Ohana Cleans Up

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her bro

wb129945130的博客 414

dify制作的工作流如何通过API调用

本文介绍了如何通过Python程序调用Dify工作流API实现数据处理功能。文章详细展示了workflow和chatflow的调用方法,包括参数设置和结果输出,并提供了一个完整的API调用工具代码示例。该工具可实现文本处理、成果查重、关键词生成等功能,支持通过Python脚本或Postman进行调用。核心代码包含API请求函数和批量处理函数,通过HTTP请求与Dify服务端交互,实现自动化数据处理流程。

hhue2007的专栏 941

Codeforces 554B Ohana Cleans Up 【水题】

题目链接:Codeforces 554B Ohana Cleans Up B. Ohana Cleans Up time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Ohana Matsumae is trying to clea

世界很大 1014

IEM模型,地表粗糙度模拟

利用微波反演土壤水分时候,利用IEM模型可以实现对随机地表的模拟

大中型超市收银系统(可直接运行)

光步前台收银系统系统功能:商品销售、商品退货、挂单、收银员权限、会员销售、单品取消、整单取消、商品查询、脱机销售、脱机数据上传,基本资料下载,开钱箱、小票打印、收款结算,支持多币种付款方式(现金、储值卡、礼券、微信等),支持多种促销。运行环境:.net 4.0登陆信息用户名:1001 密码:123456内置商品信息,商品编码可输入00001000 - 00010000,测试效果相关功能键F5 结算 F9挂单 F11商品查询 F8退货 Insert单品取消 Del整单取消 F12开钱箱F2 会员 Ctrl+Z退出系统 Home 锁屏 相关源码待公开

CodeForces 554B Ohana Cleans Up

Ohana Cleans Up Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Description Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid o

梦❤梦的博客 229

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

【codeforces 554B Ohana Cleans Up】

Ohana Cleans UpDescription Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over

楚江枫 508

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

CodeForces 554B Ohana Cleans Up

Ohana Cleans Up Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 554B Description Ohana Matsumae is trying to clean a r

皓韵儿 308

Codeforces554B:Ohana Cleans Up

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her

ACM!荣耀之路! 1713

codeforces B. Ohana Cleans Up

                            B. Ohana Cleans Up   Ohana Matsumae is trying to clean a room, which is divided up into annbyngrid of squares. Each square is initially either ...

weixin_33717117的博客 69

Codeforces Round #309 (Div. 2) B. Ohana Cleans Up 字符串水题

B. Ohana Cleans Up Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/554/problem/B Description Ohana Matsumae is trying to clean a room, which is divided up into an n ...

weixin_34413065的博客 102

CodeForces 554B Ohana Cleans Up 【思维+map】

Ohana Cleans Up Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u     Description Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares.

DTL66的博客 396

Codeforces 554B Ohana Cleans Up 扫房间

题意:给定一个由n*n块地砖铺成的房间,每块砖用0表示未打扫,1表示已打扫。要求每次打扫只能扫一整列地砖,对于其中的地砖未打扫的会变为已打扫,已打扫的会变为未打扫。即1会变成0,而0会变成1,求一种打扫方案,使得打扫完后整行地砖均为已打扫的行数最大。 首先,可以看出,如果两行地砖状态完全相同,那么无论如何打扫,这两行地砖的状态始终都是完全相同的(因为打扫的时候必须

FirstLucker 951

CodeForces 554B Ohana Cleans Up(思维)

B. Ohana Cleans Up time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ohana Matsumae is trying to clean a room,

qq_35634181的博客 349

codeforces 554B B. Ohana Cleans Up

B. Ohana Cleans Up time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Ohana Matsumae is trying to clean a room

Dreamlandz的博客 425

CodeForces 554B. Ohana Cleans Up【思维】

Ohana Matsumae is trying to clean a room, which is divided up into an n by n grid of squares. Each square is initially either clean or dirty. Ohana can sweep her broom over columns of the grid. Her broom is very strange: if she sweeps over a clean square,

小I的博客 383
上一篇: 【codeforces】-660Co-prime Array
下一篇: 【codeforces】 Bear and Reverse Radewoosh
better_space
博客等级 码龄11年 73粉丝 253原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值