#P2733. [USACO3.3] 家的范围 Home on the Range

[USACO3.3] 家的范围 Home on the Range

Description

{{FJ needs to count how many square pastures can be grazed (at least 2×22\times2 in size, and no cell in this shape is damaged; in other words, all cells are "1"). Your task is to count, in the given data, how many grazeable square pastures of size at least 2×22\times2 there are. Of course, grazing regions may overlap.}}

Input Format

{{Line 1: NN, the side length of the pasture. Lines 2 to N+1N+1: NN characters with no spaces. 00 indicates that cell is damaged; 11 indicates intact land.}}

Output Format

{{Output the side length and the count of such squares that exist, one size per line, in increasing order of side length.}}

6
101111
001111
111111
001111
101101
111001
2 10
3 4
4 1

Hint

{{Translation from NOCOW. USACO Training Section 3.3.}}

Translated by ChatGPT 5