10295_Help-or-else

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

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

Pro.ID

10295

Title

Help-or-else

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    A penal colony for finance professionals will soon be holding its annual community service activity with some rules that are considered suitable for a penal colony. Every inmate is assigned a set P of N people to help with their finances and a limit of K minutes. In addition to the circumstances of the j-th person, 1 ≤ j N, a time penalty of ej for choosing not to give advice and the time duration of dj minutes allotted to provide the advice are also made clear to the inmate.

    An inmate starts his community service at time T equal to zero. If the inmate started working with the j-th person at time T, then he must terminate his work no later than T+dj. Regardless of the validity of the advice and time of completion, a value of Cj ( = T+ dj ) is deducted from the inmate's alloted minutes. Also the inmate is not permitted to work with another person until the time T+ dj.

    If S is the set of people helped by an inmate, then the total number of used minutes is calculated as Σx ԑ S Cx + Σx ԑ P-S ex .

    Your task is to write a program to calculate the maximum number of persons that can be helped by an inmate without exceeding his K minutes limit.

    输入

    Input consists of sets for many inmates. The description for each inmate begins with two integers N and K, separated by a single space on a line by themselves, that represent the number of people and the maximum allowed minutes. 0 < N ≤ 200 and 0 < K 6000. Each of the following N lines contains two integers, separated by a single space, which represent the penalty and time duration one person to be assisted. All integers have values between 0 and 10000, inclusive. Input terminates with two zeros on a line by themselves.

    输出

    Description

    A penal colony for finance professionals will soon be holding its annual community service activity with some rules that are considered suitable for a penal colony. Every inmate is assigned a set P of N people to help with their finances and a limit of K minutes. In addition to the circumstances of the j-th person, 1 ≤ j N, a time penalty of ej for choosing not to give advice and the time duration of dj minutes allotted to provide the advice are also made clear to the inmate.

    An inmate starts his community service at time T equal to zero. If the inmate started working with the j-th person at time T, then he must terminate his work no later than T+dj. Regardless of the validity of the advice and time of completion, a value of Cj ( = T+ dj ) is deducted from the inmate's alloted minutes. Also the inmate is not permitted to work with another person until the time T+ dj.

    If S is the set of people helped by an inmate, then the total number of used minutes is calculated as Σx ԑ S Cx + Σx ԑ P-S ex .

    Your task is to write a program to calculate the maximum number of persons that can be helped by an inmate without exceeding his K minutes limit.

    Input

    Input consists of sets for many inmates. The description for each inmate begins with two integers N and K, separated by a single space on a line by themselves, that represent the number of people and the maximum allowed minutes. 0 < N ≤ 200 and 0 < K 6000. Each of the following N lines contains two integers, separated by a single space, which represent the penalty and time duration one person to be assisted. All integers have values between 0 and 10000, inclusive. Input terminates with two zeros on a line by themselves.

    Output

    For each inmate, the output consists of a single line that contains the maximum number of persons to be helped within the given time limit using the format shown. "Mission Impossible" is entered where not exceeding the given time limit is not possible.

    Sample Input

    1 1000
    100 1000
    2 100
    1000 1000
    20 10
    1 1
    0 10000
    4 293
    61 30
    295 39
    206 27
    94 85
    0 0

    Sample Output

    1: 1
    2: Mission Impossible
    3: 0
    4: 3

    Source

    样例输入

    1 1000
    100 1000
    2 100
    1000 1000
    20 10
    1 1
    0 10000
    4 293
    61 30
    295 39
    206 27
    94 85
    0 0

    样例输出

    1: 1
    2: Mission Impossible
    3: 0
    4: 3

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部