. 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