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;
typedef long long ll;
typedef vector<ll> vi;
typedef pair<ll,ll> pi;
typedef vector<pi> vpi;
typedef double ld;
#define pb emplace_back
#define mp make_pair
#define lb lower_bound
#define ub upper_bound
#define ALL(x) x.begin(), x.end()
#define SZ(x) (ll)x.size()
#define f first
#define s second
const ll MAXN=1001;
const ll MAXK=1000001;
const ll INF = 1e13;
const ll MOD = 1e9+7;
vi V;
ll T;
ll A[MAXN];
ll B[MAXN];
ll N,K;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
cin>>N>>K;
for(int i=0;i<N;++i){
cin>>A[i];
}
for(int i=0;i<N;++i){
cin>>B[i];
V.pb(B[i]-A[i]);
}
sort(ALL(V));
assert(!K);
ll ans=0;
ll r=V[N/2];
for(auto i:V)ans+=abs(i-r);
cout<<ans;
}
# | 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... |
# | 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... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |