CF847G.University Classes

入门

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

There are n student groups at the university. During the study day, each group can take no more than 7 classes. Seven time slots numbered from 1 to 7 are allocated for the classes.

The schedule on Monday is known for each group, i. e. time slots when group will have classes are known.

Your task is to determine the minimum number of rooms needed to hold classes for all groups on Monday. Note that one room can hold at most one group class in a single time slot.

大学里有 nn 个学生小组。在学习日,每个小组最多可安排 7 节课。共有编号为 1 到 7 的七个时间段用于安排课程。

已知每个小组在周一的课程表,即每个小组在哪些时间段有课是已知的。

你的任务是确定周一为所有小组安排课程所需的最少教室数量。注意:在任一时间段内,一间教室最多只能容纳一个小组的课程。

输入格式

The first line contains a single integer n (1 ≤ n ≤ 1000) — the number of groups.

Each of the following n lines contains a sequence consisting of 7 zeroes and ones — the schedule of classes on Monday for a group. If the symbol in a position equals to 1 then the group has class in the corresponding time slot. In the other case, the group has no class in the corresponding time slot.

第一行包含一个整数 nn(1≤n≤10001 \leq n \leq 1000)—— 组的数量。

接下来的 nn 行中,每行包含一个由 7 个 0 和 1 组成的序列 —— 表示该组在周一的课程安排。若某位置上的字符为 1,则表示该组在对应的时间段有课;否则(即为 0),表示该组在对应的时间段没有课。

输出格式

Print minimum number of rooms needed to hold all groups classes on Monday.

输出周一安排所有小组课程所需的最少教室数量。

输入输出样例

  • 输入#1

    2
    0101010
    1010101

    输出#1

    1
  • 输入#2

    3
    0101011
    0011001
    0110111

    输出#2

    3

说明/提示

In the first example one room is enough. It will be occupied in each of the seven time slot by the first group or by the second group.

In the second example three rooms is enough, because in the seventh time slot all three groups have classes.

在第一个例子中,一个教室就足够了。在七个时间段中的每一个,该教室都会被第一组或第二组占用。

在第二个例子中,三个教室就足够了,因为在第七个时间段,所有三个小组都有课。

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

首页