This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#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);
ll r = 0, m = C[(N + M) / 2];
for(ll i = 1; i < N + M; i++){
r += abs(m - C[i]);
}
cout << r;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |