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;
int n,m;
vector<pair<int,int> > v[200001];
vector<int> val;
void read()
{
cin>>n>>m;
for(int i=2;i<=n+m;i++)
{
int x,y;
cin>>x>>y;
val.push_back(y);
v[i].push_back({x,y});
}
if(n==1)
{
sort(val.begin(),val.end());
int sz=val.size();
long long need=val[sz/2],ans=0;
for(int i=0;i<sz;i++)
ans+=abs(val[i]-need);
cout<<ans<<endl;
exit(0);
}
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
read();
return 0;
}
# | 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... |