In a large university, various departments offer courses with different credit values. The university wants to assign courses to departments based on the department's capacity to handle the course credits. Each department has a specific capacity, and each course has a specific credit value. The goal is to assign one course to each department based on the following rules:
D
, representing the number of departments.D
integers, representing the capacities of the departments.C
, representing the number of courses.C
integers, representing the credit values of the courses.1 <= D <= 10^5
1 <= C <= 10^5
1 <= department_capacity <= 10^5
1 <= course_credit <= 10^5
A list of integers, where each integer represents the course ID assigned to the corresponding department, or -1 if no suitable course exists.
5
8 4 3 2 4
2
4 2
0 0 -1 1 0
4
2 3 5 7
3
5 3 3
-1 1 0 -1
4
10 21 30 41
2
2 1
0 1 0 1