#BS0000341. Chuẩn bị kỳ thi (Preparing for the Contest)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Chuẩn bị kỳ thi (Preparing for the Contest)
Preparing for the Contest
Source: Codeforces
Version: Phuoc Hung OJ Extended
Problem Statement
A judging system has independent bugs of difficulty . Student has ability and charges passes once if hired, regardless of workload. A student can fix at most one bug per day and only if . Students work in parallel. With total budget , find a schedule minimizing the number of days, or report impossibility.
Input
First line: . Second line: difficulties . Third line: abilities . Fourth line: costs . Both students and bugs are numbered from 1.
Output
Print NO if no feasible schedule exists. Otherwise print YES and student indices on the next line, in original bug order. The assignment must minimize the number of days within budget. Any optimal assignment is accepted.
Subtask
- Subtask 1 (20 points): ; ; ; .
- Subtask 2 (30 points): ; ; ; . .
- Subtask 3 (50 points): ; ; ; .
Examples
Input 1
3 4 9
1 3 1 2
2 1 3
4 3 6
Output 1
YES
2 3 2 3
Explanation
Student 2 handles two difficulty-1 bugs and student 3 handles difficulties 3 and 2. Cost is 9 and completion takes two days. One day would require four students.
Input 2
3 4 5
1 3 1 2
2 1 3
5 3 6
Output 2
NO
Explanation
Only student 3 can fix difficulty 3, but the cost 6 exceeds the budget.