Nộp bài | Các bài nộp | Làm tốt nhất | Về danh sách bài |
RECT3 - Khối tam chữ nhật |
English | Vietnamese |
Three-rectangle blocks
Given a MxN rectangle (1 ≤ M, N ≤ 200) containing 0 and 1. A three-rectangle block is a shape consiting of three rectangles, each rectangle contains only 1, overlapping one another so that the middle rectangle must be wider than the top and bottom rectangle in both left and right directions by at least one cell.
For example, the following shapes are three-rectangle blocks:
1 111 1 11 11 11111 1 1
The following shapes are not three-rectangle blocks:
111 11111 111 111 (The three rectangles are not connected) 1111 1111 11111 111 111 (The middle rectangle is not wider than the top rectangle by at least one cell to the right)
In this problem, you have to find the three-rectangle block that has maximum area.
Input
- First line: two integers M, N.
- In the next M lines, each line contains N numbers 0 and 1 (not separated by spaces) representing the rectangle of numbers.
Output
Print the area of the largest three-rectangle block, or 0 if there is no such a block.
Example
Input 6 8 00000110 00111000 00110100 01111001 01111110 00111010 Output 15 Output details The three-rectangle block: 00000110 00111000 00110100 01111001 01111110 00111010 Has an area of 15 Another three-rectangle block that has an area of 14: 00000110 00111000 00110100 01111001 01111110 00111010
Được gửi lên bởi: | VOJ Team |
Ngày: | 2008-08-13 |
Thời gian chạy: | 0.200s-0.400s |
Giới hạn mã nguồn: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Ngôn ngữ cho phép: | ADA95 ASM32 BASH BF C CSHARP CPP C99 CLPS LISP sbcl LISP clisp D FORTRAN HASK ICON ICK JAVA LUA NEM NICE OCAML PAS-GPC PAS-FPC PERL PHP PIKE PRLG-swi PYTHON RUBY SCM guile SCM qobi ST TEXT WHITESPACE |
Nguồn bài: | VNOI Marathon'08-Round 9/DivA Problem Setter:Nguyễn Trần Nam Khánh |