#P1678. 烦恼的高考志愿
烦恼的高考志愿
Description
There are schools, each with an expected cutoff score . There are students, with estimated scores .
Based on the estimated scores of the students, recommend one school to each student such that the difference between the school’s expected cutoff score and the student’s estimated score is minimized (either higher or lower—after all, it’s just an estimate). This minimum difference is called dissatisfaction. Find the minimum possible sum of dissatisfaction over all students.
Input Format
The first line contains two integers .
The second line contains numbers, representing the expected cutoff scores of the schools.
The third line contains numbers, representing the estimated scores of the students.
Output Format
Output one line, the minimum sum of dissatisfaction.
4 3
513 598 567 689
500 600 550
32
Hint
Constraints:
For of the testdata, , and the estimated scores and cutoffs are .
For of the testdata, , the estimated scores and cutoffs are , and all are non-negative integers.
Translated by ChatGPT 5
京公网安备 11011102002149号