Avoid the Lakes
Time Limit: 1000MS |
|
Memory Limit: 65536K |
Total Submissions: 6826 |
|
Accepted: 3637 |
Description
Farmer John's farm was flooded in the most recent storm, a fact-only aggravated by the information so his cows is death Ly afraid of water. His insurance agency would only repay him, however, a amount depending on the size of the largest "lake" on his farm.
The farm is represented as a rectangular grid with N (1≤ n ≤100) rows andm (1≤m ≤1 XX) columns. Each cell in the grid is either dry or submerged, and exactlyK (1≤k ≤N x M) of the CE LLS is submerged. As one would expect, a lake has a central cell to which and other cells connect by sharing a long edge (not a corner). Any cell this shares a long edge with the central cell or shares a long edge with any connected cell becomes a connected C Ell and is part of the lake.
Input
* Line 1:three space-separated integers: N, M, and K
* Lines 2. K+1:line i+1 describes one submerged location with II space separated integers that is its row and co Lumn:R andC
Output
* Line 1:the number of cells the the largest lake contains.
Sample Input
3 4 53 22 23 12 31 1
Problem description
The farmer John's farm was submerged by a recent storm (flooded), but the truth is still worse (aggravated), because his cow is afraid of water, is dying. However, his insurance company (Insurance Agency) will compensate for the size of the largest pool on his farm.
His farm is visible as a rectangular (rectangular) grid (grid) of n rows (rows) m-Columns (columns). Each cell (cell) is either dry or in water (submerged), and, to be exact, K (1≤k ≤N xM) is wet,
Input
First line: Three separate integers, n,m and K
The second line ... Line k+1: section i+1 behavior Wetland coordinates, HORIZONTAL axis R and ordinate c
Output:
First row: Number of squares of the largest lake
POJ 3620 Avoid The Lakes "Dfs find Unicom block"