#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll N, M;
ll P[300005], C[300005];
int main(){
cin.tie(0) -> sync_with_stdio(false);
cin >> N >> M;
for(ll i = 1; i <= N + M; i++){
cin >> P[i] >> C[i];
}
sort(C + 1, C + N + M + 1);
ll r = 0, m = C[(N + M + 1) / 2];
for(ll i = 1; i <= N + M; i++){
r += abs(m - C[i]);
}
cout << r;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |