<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    posts - 36,  comments - 3,  trackbacks - 0

    Largest Rectangle in a Histogram

    Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)
    Total Submission(s): 7038    Accepted Submission(s): 1982


    Problem Description
    A histogram is a polygon composed of a sequence of rectangles aligned at a common base line. The rectangles have equal widths but may have different heights. For example, the figure on the left shows the histogram that consists of rectangles with the heights 2, 1, 4, 5, 1, 3, 3, measured in units where 1 is the width of the rectangles:

    Usually, histograms are used to represent discrete distributions, e.g., the frequencies of characters in texts. Note that the order of the rectangles, i.e., their heights, is important. Calculate the area of the largest rectangle in a histogram that is aligned at the common base line, too. The figure on the right shows the largest aligned rectangle for the depicted histogram.
     

    Input
    The input contains several test cases. Each test case describes a histogram and starts with an integer n, denoting the number of rectangles it is composed of. You may assume that 1 <= n <= 100000. Then follow n integers h1, ..., hn, where 0 <= hi <= 1000000000. These numbers denote the heights of the rectangles of the histogram in left-to-right order. The width of each rectangle is 1. A zero follows the input for the last test case.
     

    Output
    For each test case output on a single line the area of the largest rectangle in the specified histogram. Remember that this rectangle must be aligned at the common base line.
     

    Sample Input
    7 2 1 4 5 1 3 3 4 1000 1000 1000 1000 0
     

    Sample Output
    8 4000


    PS:有無有更加快速的方法呢,時間上還是比較慢









    posted on 2013-05-01 23:19 天YU地___PS,代碼人生 閱讀(187) 評論(0)  編輯  收藏 所屬分類: acm
    <2013年5月>
    2829301234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

     一定要好好學習,天天向上!

    常用鏈接

    留言簿

    隨筆分類(8)

    隨筆檔案(35)

    文章分類

    文章檔案(1)

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产成人免费高清激情视频| 久久免费的精品国产V∧| 免费可以在线看A∨网站| 91大神亚洲影视在线| 日本视频在线观看永久免费| 亚洲精品成人片在线观看精品字幕 | 西西人体免费视频| 免费A级毛片无码A| 粉色视频在线观看www免费| 国产一区视频在线免费观看| 国产亚洲精品美女| 亚洲国产高清在线一区二区三区| 特级毛片全部免费播放| 亚洲国产91精品无码专区| 一级毛片视频免费| 亚洲日韩精品一区二区三区无码| 亚洲天堂免费在线视频| 亚洲午夜久久久影院伊人| 久久精品电影免费动漫| 噜噜噜亚洲色成人网站∨| 国产卡一卡二卡三免费入口| 亚洲av午夜国产精品无码中文字| 亚洲&#228;v永久无码精品天堂久久 | 亚洲综合一区二区精品久久| 国产精品成人观看视频免费| 亚洲色大18成人网站WWW在线播放 亚洲色大成WWW亚洲女子 | 亚洲av无码成人精品国产| 免费一级大黄特色大片| 九九久久精品国产免费看小说| 亚洲精品无码久久久久| 亚洲视频免费播放| 亚洲爆乳无码专区www| 久久99亚洲综合精品首页 | 亚洲日本中文字幕一区二区三区| 中文无码成人免费视频在线观看| 亚洲欧洲精品视频在线观看| 国产精品二区三区免费播放心| 成人无码视频97免费| 亚洲成a人片在线观看中文!!!| 国产一级大片免费看| 免费A级毛片无码A∨|