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

Сборники > Kovrov IT > задача:


50791 - Mine field

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

Задачи сборника

• 50743 - Total Scholarships Discount
• 50740 - Service Time - 1
• 50988 - Laplacian Filter
• 50747 - Safe boxes against thieves
• 50742 - King Arthur II
• 50928 - War Of Battleships
• 50930 - Tom and Jerry
• 50925 - Optimizing Elevator Usage
• 50791 - Mine field
• Trip to Librazhd
• 50912 - Trip to Librazhd
• 50914 - Buy 3, Pay 2
• 50563 - Modul i gjate
• 50565 - Numra binare
• 50569 - Lendet me zgjedhje per kla...
• 50594 - Transformimet
• 51182 - Count and Sum 2

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

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

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Rovshan Zeynalov.

Mine field

Enemies put mines to the field which is the entrance of occupied area. But spies sent some useful information about minefield. Now your army knows that enemies marked every mine. For easily find the path, enemies planted flowers to all sides of mines and one flower on the mine. Colors of flowers on all mines are same (1). Colors of flowers around one mine are same too (different from flower on the mine). However, color of flowers around one mine can be different than the color of flowers around another. For example, color of flowers on all mines is white, color of flowers around mine with coordinates [3][6] is green, but color of flowers around mine - [6][5] is blue.

Private Tofig must find coordinates of all mines and number of them. Help him. But be careful. Sneaky enemy planted colorful flowers all around. You must act on the plan.

Input specification
First line contains two numbers N and M (1 ≤ N, M ≤ 100) – sizes of matrix (minefield). Next N lines contains minefield. Each line contains M numbers from 0 to 5 (colors of flowers) with no spaces.

Output specification
First show a single integer on a line – number of mines. Then show the coordinates of mines on the following lines.

Sample Input I
8 13
1111011112221
5111000112121
1111010112221
1311000112131
1114441112221
1114141115550
1114441115351
1141111115553
Sample Input II
4 7
2221101
2101000
2221010
1101000
Sample Output I
3
2 11
3 6
6 5
Sample Output II
1
3 6


Для отправки решений необходимо выполнить вход.

www.contester.ru