At IOI 2022, Team Canada encountered a mystery with the hotel elevators. Puzzled, they have asked you (their tour guide) to solve it for them.
The elevator system of the hotel can be viewed as a 2-D grid
A contiguous subsequence of floors
Your task is to determine the length of the largest explorable contiguous subsequence of floors.
Constraints
Subtask 1 [10%]
Subtask 2 [20%]
Subtask 3 [30%]
Subtask 4 [40%]
No additional constraints.
Input Specification
The first line contains
The next
Output Specification
Output the length of the largest explorable contiguous subsequence of floors.
Sample Input
5 3
001
010
011
100
001
Sample Output
3
Explanation for Sample
The largest contiguous subsequence of floors that is explorable is
Comments
I finally accepted this problem.