当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

2906:Moving Pianos

题目描述

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.

输出解释

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.

输入样例
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

该题目是Virtual Judge题目,来自 北京大学POJ

源链接: POJ-2906

最后修改于 2020-10-29T06:47:16+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 65536