CF688A.Opponents
入门
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
Arya has n opponents in the school. Each day he will fight with all opponents who are present this day. His opponents have some fighting plan that guarantees they will win, but implementing this plan requires presence of them all. That means if one day at least one of Arya's opponents is absent at the school, then Arya will beat all present opponents. Otherwise, if all opponents are present, then they will beat Arya.
For each opponent Arya knows his schedule — whether or not he is going to present on each particular day. Tell him the maximum number of consecutive days that he will beat all present opponents.
Note, that if some day there are no opponents present, Arya still considers he beats all the present opponents.
阿瑞亚在学校里有 n 个对手。每天,他都会与当天到场的所有对手进行战斗。这些对手有一套必胜的作战计划,但该计划的实施要求所有对手必须全部到场。也就是说:如果某天至少有一名阿瑞亚的对手缺席,则阿瑞亚将击败当天所有到场的对手;否则,若所有对手都到场,则他们将击败阿瑞亚。
对于每一名对手,阿瑞亚都知道其日程安排——即该对手在每一天是否到场。请告诉他,他能连续击败当天所有到场对手的最长天数是多少。
注意:若某天没有任何对手到场,阿瑞亚仍视作“击败了当天所有到场的对手”。
输入格式
The first line of the input contains two integers n and d (1 ≤ n, d ≤ 100) — the number of opponents and the number of days, respectively.
The i-th of the following d lines contains a string of length n consisting of characters '0' and '1'. The j-th character of this string is '0' if the j-th opponent is going to be absent on the i-th day.
输入的第一行包含两个整数 n 和 d(1≤n,d≤100),分别表示对手的数量和天数。
接下来的 d 行中,第 i 行包含一个长度为 n 的字符串,仅由字符 '0' 和 '1' 组成。该字符串的第 j 个字符为 '0' 表示第 j 个对手在第 i 天缺席。
输出格式
Print the only integer — the maximum number of consecutive days that Arya will beat all present opponents.
输出唯一的整数——Arya 将连续击败所有在场对手的最多天数。
输入输出样例
输入#1
2 2 10 00
输出#1
2
输入#2
4 1 0100
输出#2
1
输入#3
4 5 1101 1111 0110 1011 1111
输出#3
2
说明/提示
In the first and the second samples, Arya will beat all present opponents each of the d days.
In the third sample, Arya will beat his opponents on days 1, 3 and 4 and his opponents will beat him on days 2 and 5. Thus, the maximum number of consecutive winning days is 2, which happens on days 3 and 4.
在第一个和第二个样例中,Arya 将在全部 d 天内击败所有当前存在的对手。
在第三个样例中,Arya 将在第 1、3 和 4 天击败他的对手,而他的对手将在第 2 和第 5 天击败他。因此,最长的连续获胜天数为 2,出现在第 3 天和第 4 天。
输入解题思路,AI测评打分。不知道怎么写?