#P2823. 时间表
时间表
Description
Each person can only choose one of attending meetings, talking to customers, or working on research projects in any given hour. To improve efficiency, each hour must be devoted entirely to one of these tasks, and they cannot switch in the middle.
Xiao A lives in a strange place where a week has days, labeled from to . To protect the employees' voices, person can talk to customers for at most hours per week.
Meetings are pre-planned, and the times at which each person needs to attend meetings are fixed. The call service center can respond to customer calls for hours each day; for convenience, these hours are labeled from to .
For each day and hour of the week, the number of customers connecting to the call service center is known. Therefore, Xiao A knows that on day at hour , exactly employees must be scheduled to talk to customers. If person has no meeting at day , hour and can take customer calls, then ; otherwise .
Again, Xiao A's world is quite strange: not only might a week not have days, but a day might also not have hours.
Xiao A needs to create a timetable for each employee. Since employees also need to eat and rest, there is a lunch break every day from to inclusive. Xiao A must ensure that each employee has at least one hour within this interval during which they are neither in a meeting nor talking to customers, so that they can eat, rest, or do what they want.
If someone has neither a meeting nor customer calls in an hour, they can work on the company’s research projects during that hour, and this counts as working time. They might also work on their own projects, but that does not count as working time.
Xiao A wants to know whether it is possible to arrange such a timetable that satisfies all of the following:
- Each person spends at most hours per day on meetings and customer calls.
- Each person spends at most hours per week talking to customers.
- Each person has at least one hour during the lunch break when they are neither in a meeting nor talking to customers.
- For day , hour , exactly people are talking to customers.
Input Format
The first line contains a positive integer , the number of testdata sets.
For each testdata set, the first line contains four integers , representing the number of people in the team, the number of working days per week, the number of hours per day during which the call service center can respond to customer calls, and the daily per-person limit on time spent on meetings and customer calls, respectively.
The next line contains integers, where the -th integer is .
The next line contains two integers and , representing the lunch break interval.
Then follow lines, each containing integers; on the -th line, the -th integer is .
Then follow blocks; each block has lines, and each line contains integers. In the -th block, the number on the -th line and -th position is .
Output Format
Output lines. For the -th testdata set, print Yes if a feasible schedule exists; otherwise, print No.
2
2 2 3 2
4 1
2 3
0 1 1
0 1 0
1 1 1
1 1 1
1 1 1
1 0 1
2 2 3 2
4 1
2 3
0 1 2
0 1 0
1 1 1
1 1 1
1 1 1
1 0 1
Yes
No
Hint
Constraints:
For of the testdata, the following hold:
.
$1 \leq D, P \leq 70, 1 \leq L_i \leq N \times D, 0 \leq R_{i,j} \leq 15$.
$0 \leq F_{k,i,j} \leq 1, 1 \leq L_{\text{T}_\text{begin}} \leq L_{\text{T}_\text{end}} \leq H$.
Translated by ChatGPT 5
京公网安备 11011102002149号