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

Разделы > Поиск > задача:


50791 - Mine field

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

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

• 51046 - The biggest number
• 50453 - The Cubic Difference
• 50451 - Processing Cost
• 50538 - Sum of kth Diagonal
• 50535 - Image Compression
• 50470 - Close Pairs - Revised
• 50459 - The Biggest Digit
• 50784 - Top Growing Company
• 50791 - Mine field
• 50867 - Average of the Best Grades
• 50460 - Numrin e Mesem
• 50566 - Mesatarja e pikeve te notav...
• 50573 - Numri dhe shuma
• 50575 - Numri i numrave prim
• 50576 - Numri i numrave perfekte
• 50588 - Perpunimi i nje liste numrash
• Cifti me i afert

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

Если у вас есть предложения или пожелания по работе 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