<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,代碼人生 閱讀(186) 評論(0)  編輯  收藏 所屬分類: acm
    <2013年5月>
    2829301234
    567891011
    12131415161718
    19202122232425
    2627282930311
    2345678

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

    常用鏈接

    留言簿

    隨筆分類(8)

    隨筆檔案(35)

    文章分類

    文章檔案(1)

    搜索

    •  

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 最近免费中文字幕4| 国产片AV片永久免费观看 | 亚洲av乱码一区二区三区| 亚洲六月丁香婷婷综合| 亚洲欧好州第一的日产suv| 一级做α爱过程免费视频| 在线人成免费视频69国产| 麻花传媒剧在线mv免费观看 | 100部毛片免费全部播放完整| 中文字幕人成无码免费视频| 日本高清色本免费现在观看| 亚洲综合色在线观看亚洲| 亚洲av无码一区二区三区乱子伦 | 美女啪啪网站又黄又免费| 中文字幕高清免费不卡视频| 亚洲国产精品免费在线观看| 国产精品无码素人福利免费 | 亚洲自偷自偷在线制服| 亚洲视频一区在线| 亚洲Aⅴ在线无码播放毛片一线天| 成人A毛片免费观看网站| 2021国产精品成人免费视频| 免费a级毛片18以上观看精品| 亚洲一区二区三区高清| 亚洲精品久久无码| 久久久久久影院久久久久免费精品国产小说 | 免费看一级一级人妻片| 无码AV片在线观看免费| 日韩免费a级在线观看| 亚洲大成色www永久网站| 亚洲精品国产综合久久久久紧| 成全视频在线观看免费| 成年女人毛片免费播放视频m| 亚洲国产另类久久久精品黑人| 亚洲AV成人无码天堂| 成人网站免费大全日韩国产| 国产在线观看片a免费观看| 曰韩亚洲av人人夜夜澡人人爽| 亚洲综合一区无码精品| 免费福利在线视频| 全部免费a级毛片|