Isolator
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
The isolation ward consists of a grid with dimensions N by M, where each cell either contains a bed of size 1×1 or is empty. The ward is divided into multiple sectors, where movement is possible between adjacent cells within the same sector, but not between different sectors. Your task is to determine the number of such sectors.
Input
The first line contains two integers, N and M (1 ≤ N, M ≤ 100), representing the dimensions of the isolation ward. The following N lines each contain M integers, where a 1 indicates the presence of a bed in that cell, and a 0 indicates an empty cell.
Output
Output the total number of sectors in the isolation ward.
Examples
Input #1
Answer #1
Submissions 258
Acceptance rate 58%