22173_RebuildTheGreatWa

2022-5-16 18:21| 发布者: Hocassian| 查看: 20| 评论: 0|原作者: 肇庆学院ACM合集

摘要:
C:\Users\Administrator\Downloads\2019-10-12-10-14-5-89506173320200-Problem List-采集的数据-后羿采集器.html

Pro.ID

22173

Title

Rebuild The Great Wall

Title链接

http://10.20.2.8/oj/exercise/problem?problem_id=22173

AC

0

Submit

0

Ratio

-

时间&空间限制

  • Time Limit: 2000/1000 MS (Java/Others)     Memory Limit: 65536/65536 K (Java/Others)
  • 描述

    In 1368 A.D., in China, the king Yuanzhang Zhu won the war and build up the Ming dynasty, we've talked about that before. To resist Mongolian army, the King decided to rebuild the Great Wall. However, the Kingdom spent quite a lot of money on the project before (If you are confuse, please check out the former problem! ^_^), they can only rebuild part of the Great Wall.

    There're many segments of Great Wall from west to east. For every segment, there's an integer number as resistant value. Now, the kingdom wants to continuously rebuild minimum segments that the sum of resistant value is greater than T.

    输入

    There're several groups of data.

    For each group, the first line of Input contains two integer N ( N ≤ 100000 ) and T ( T ≤ 2*109 ). N means the number of segments of Great Wall, T was defined in background.

    And then N integers in one line present the resistant value of every segment from west to east.

    输出

    Description

    In 1368 A.D., in China, the king Yuanzhang Zhu won the war and build up the Ming dynasty, we've talked about that before. To resist Mongolian army, the King decided to rebuild the Great Wall. However, the Kingdom spent quite a lot of money on the project before (If you are confuse, please check out the former problem! ^_^), they can only rebuild part of the Great Wall.

    There're many segments of Great Wall from west to east. For every segment, there's an integer number as resistant value. Now, the kingdom wants to continuously rebuild minimum segments that the sum of resistant value is greater than T.

    Input

    There're several groups of data.

    For each group, the first line of Input contains two integer N ( N ≤ 100000 ) and T ( T ≤ 2*109 ). N means the number of segments of Great Wall, T was defined in background.

    And then N integers in one line present the resistant value of every segment from west to east.

    Output

    Output one integer as the minimum number of continuously segments in one line.

    If there's no solution, print out -1 in one line.

    Sample Input

    7 18
    5 8 4 9 10 5 2

    Sample Output

    2
    2

    Source

    样例输入

    7 18
    5 8 4 9 10 5 2

    样例输出

    2
    2

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部