HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Sections > Recursion > problem:


50475 - Voice advertising

Guest
• Discussion of problem (1)

Section problems

• 50723 - Tribonacci
• 50370 - Number of rectangles in a ...
• 50475 - Voice advertising
• 50909 - Gold Coins
• 50376 - Sequences
• 50725 - Fibonacci Series
• 50385 - The 3n + 1 problem
• 50911 - Symmetric Array
• 50381 - Sum of the numbers
• 50389 - Reverse an Array
• 50727 - Fibonacci Numbers

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/4000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.
National Olympiads in Montenegro. Difficulty Beta

Voice advertising

One sector in a soccer stadium has a rectangle shape with H rows and W seats in each row. Some seats are empty and some are filled with soccer fans. During the game, fans shout different slogans. It goes as follows:

If fan A from one seat starts shouting, then fans sitting on his left, right, up, and down do the same. Then, the neighbors of these do the same, and so on.  A sponsor of the soccer team would like that the fans "spontaneously" shout the slogan of his company. They have hired Mirko to sit on a free seat and starts shouting the slogan of the company. A sponsor aims that the number of people who shout their slogan is as large as possible.  Your duty is to help out Mirko to pick a seat that will allow him to induce a shout of a maximum number of fans.

 Input: The first row of the input file contains the numbers W and H, 2<=W, H ≤ 2000.

 The next H lines of the file contain W characters. Each character is either a '.' (ASCII code 46) –marking a free seat, or '#’ (ASCII code 35) – marking an occupied seat. There is at least one free seat.

Output: Print two integers x and y, separated by a blank, that marks the number of seats and the number of rows.

Rows are marked with 1 to H, in top-bottom order. Seats are enumerated with numbers 1 to W from left to right

Example:

 

Test case 1

Test case 2

Test case 3

Input

2 2

#.

.#

5 5
..#.#
..###
#..##
#.##.
#....


6 4
######
.....#
..##.#
...#.#

Output

2 1

2 4

3 2

 

Äëÿ îòïðàâêè ðåøåíèé íåîáõîäèìî âûïîëíèòü âõîä.

www.contester.ru