22866_MovingPianos

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

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

Pro.ID

22866

Title

Moving Pianos

Title链接

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

AC

0

Submit

0

Ratio

-

时间&空间限制

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

    A piano-tuner indeed has a hard time earning his living. (Un)fortunately, most people want their pianos tuned only when they move to a new place, and thus also someone to help them move the piano. Therefore, quite a few piano-tuners combine their profession with lifting and transporting pianos. However, as you might guess, they are not all that keen on doing a lot of heavy-weight carrying in a day, and they certainly don't want to work weekends! In the city of Hampstead, the small group of piano-tuners have joined forces, and they help each other by taking turns in moving the pianos. No piano-tuner transports more than one piano a day under any circumstance, and they always work in pairs. As with most craftsmen, you seldom get to know precisely when the job you request will be carried out. Instead, when ordering a piano move, you are given an arbitrary long time interval containing your desired moving day, during which your piano is guaranteed to be moved by the piano-tuners. This strategy often makes the scheduling task easy, but this time they just might have put themselves in some trouble. During the last days, the piano-tuners have received a lot of piano move orders for the next 100 days, and they are afraid that even if they work weekends they cannot keep their promises. To help them see if this is the case, and to avoid it in the future, they would like a computer program testing different scenarios.

    输入

    On the first line is a single positive integer n, specifying the number of test scenarios to follow. Each scenario begin with two positive integers m and p on a line of their own, m ≤ 1000, telling the number of pianos to be moved, and p ≤ 2000 the number of piano-tuners. Then follow m lines, each containing a piano move order on the format of two integers bi and ei with 1 ≤ biei ≤ 100 meaning that between the beginning of day bi and the end of day ei, the piano i must be moved. Day 1 is always a Monday, 2 a Tuesday and so on.

    输出

    Description

    A piano-tuner indeed has a hard time earning his living. (Un)fortunately, most people want their pianos tuned only when they move to a new place, and thus also someone to help them move the piano. Therefore, quite a few piano-tuners combine their profession with lifting and transporting pianos. However, as you might guess, they are not all that keen on doing a lot of heavy-weight carrying in a day, and they certainly don't want to work weekends! In the city of Hampstead, the small group of piano-tuners have joined forces, and they help each other by taking turns in moving the pianos. No piano-tuner transports more than one piano a day under any circumstance, and they always work in pairs. As with most craftsmen, you seldom get to know precisely when the job you request will be carried out. Instead, when ordering a piano move, you are given an arbitrary long time interval containing your desired moving day, during which your piano is guaranteed to be moved by the piano-tuners. This strategy often makes the scheduling task easy, but this time they just might have put themselves in some trouble. During the last days, the piano-tuners have received a lot of piano move orders for the next 100 days, and they are afraid that even if they work weekends they cannot keep their promises. To help them see if this is the case, and to avoid it in the future, they would like a computer program testing different scenarios.

    Input

    On the first line is a single positive integer n, specifying the number of test scenarios to follow. Each scenario begin with two positive integers m and p on a line of their own, m ≤ 1000, telling the number of pianos to be moved, and p ≤ 2000 the number of piano-tuners. Then follow m lines, each containing a piano move order on the format of two integers bi and ei with 1 ≤ biei ≤ 100 meaning that between the beginning of day bi and the end of day ei, the piano i must be moved. Day 1 is always a Monday, 2 a Tuesday and so on.

    Output

    For each test scenario, output the text "serious trouble" if the list of piano move orders cannot be executed as promised even if all the p pianotuners worked everyday, the text "weekend work" if at least two pianotuners have to work some Saturday or Sunday, or the text "fine" if it is possible to carry out all the moves during the five working days of the weeks.

    Sample Input

    3
    3 2
    4 5
    5 6
    5 7
    2 5
    49 50
    50 50
    4 2
    8 10
    8 10
    8 10
    8 10

    Sample Output

    weekend work
    fine
    serious trouble

    Source

    样例输入

    3
    3 2
    4 5
    5 6
    5 7
    2 5
    49 50
    50 50
    4 2
    8 10
    8 10
    8 10
    8 10

    样例输出

    weekend work
    fine
    serious trouble

    作者


    路过

    雷人

    握手

    鲜花

    鸡蛋

    最新评论

    返回顶部