CF554B.Ohana Cleans Up

普及-

通过率:0%

时间限制:2.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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.

小野花松前正在打扫一个房间,该房间被划分为一个 n×nn \times n 的方格网格。每个方格初始状态为洁净或肮脏。小野花可以使用扫帚清扫网格的某些列。她的扫帚非常特别:若扫过一个洁净的方格,它会变为肮脏;若扫过一个肮脏的方格,它会变为洁净。她希望通过清扫若干列,使得完全洁净的行数尽可能多。注意:不允许只清扫某一列的一部分,小野花只能完整地清扫整列。

请返回她所能达成的完全洁净的行数的最大值。

输入格式

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.

输入的第一行是一个整数 nn(1≤n≤1001 \leq n \leq 100)。

接下来的 nn 行描述房间的状态。第 ii 行包含一个长度为 nn 的二进制字符串,表示房间第 ii 行的状态。该行的第 jj 个字符为 '1' 表示第 ii 行第 jj 列的方格是干净的,为 '0' 表示该方格是脏的。

输出格式

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

输出应为一行,包含一个整数,表示完全干净的行的最大可能数量。

输入输出样例

  • 输入#1

    4
    0101
    1000
    1111
    0101

    输出#1

    2
  • 输入#2

    3
    111
    111
    111

    输出#2

    3

说明/提示

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.

在第一个样例中,Ohana 可以清扫第 1 列和第 3 列。这将使得第 1 行和第 4 行完全干净。

在第二个样例中,所有内容已经干净,因此 Ohana 无需执行任何操作。

输入解题思路,AI测评打分。不知道怎么写?

首页