"The real puzzle" cattle Palace

Source: Internet
Author: User

. Ox Palace
(Long.pas/c/cpp)
"Problem description"
The AP God Ox is ready to build himself a magnificent palace. So he took a fancy to a n*m rectangular glade. Empty
Each grid in the ground has its own altitude. The AP wants to get his palace's average elevation above sea level (assuming haiping
The height of the face is 0, the average will be counted? ) 。 Moreover, the AP wants his palace to be as large as possible to accommodate more people to
Worship Him. How big Will the AP's palace last (the palace must be a rectangle)?
Input
The first acts N and M. After N rows, the number of M per line, the altitude of the Open space described (the range of values in Longint
In the range).
Output
The output line indicates the maximum area of the palace.
"Output Output Sample"
Long.in Long.out
3 2 4
4 0
-10 8
-2-2
4

"Data Size"
For 30% of data, n,m≤50;
For 100% of data, n,m≤200;

Really is with a monotone stack, 2333.

First the matrix is pressed into one dimension (if you do not know how to do it, you can look at my pseudo-puzzle).

Then there will be a problem, the longest continuous and positive sequence.

The previous practice is to prefix and then enumerate the start and end,

Of course this will time out, so I thought of using a monotonous stack.

If you set an end, from ... I'll write it later.

"The real puzzle" cattle Palace

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.