ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Разделы > Рекурсия > задача:


50475 - Voice advertising

Гость
• Обсуждение задачи (1)

Задачи раздела

• 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

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
National Olympiads in Montenegro. Сложность Бета

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