#P3270. [JLOI2016] 成绩比较
[JLOI2016] 成绩比较
Description
The G Department has students and required courses. The students are numbered by integers from to , and B Shen's number is . The required courses are numbered from to . In each required course, a student can earn an integer score from to inclusive.
If in every course A's score is less than or equal to B's score, then A is said to be dominated by B. According to B Shen, there are students whom he dominates (excluding himself), and the other students are not dominated by him. D Shen has found B Shen's rank in each required course.
Here, rank means: if B Shen's rank in some course is , then exactly students have a score strictly greater than B Shen's score in that course, and exactly students have a score less than or equal to B Shen's score in that course (excluding himself).
We need to count the number of possible score assignments for all students in all required courses that satisfy both B Shen's statement and the ranks found by D Shen. Two assignments are different if and only if there exists at least one student and one course where the assigned score differs.
You do not need to be as powerful as D Shen; just compute the answer modulo .
Input Format
- The first line contains three positive integers , denoting the number of students in the G Department (including B Shen), the number of required courses, and the number of students dominated by B Shen.
- The second line contains positive integers, the maximum score of each course in order.
- The third line contains positive integers, B Shen's rank in each course in order.
- It is guaranteed that there is at least one assignment that makes B Shen's statement hold.
Output Format
Output a single integer on one line, the number of valid assignments modulo .
3 2 1
2 2
1 2
10
Hint
Constraints: , , , .
Translated by ChatGPT 5
京公网安备 11011102002149号