Submission #116788

#TimeUsernameProblemLanguageResultExecution timeMemory
116788ioilolcomSimfonija (COCI19_simfonija)C++14
0 / 110
30 ms3020 KiB
#include <bits/stdc++.h> using namespace std; #define endl "\n" typedef long long int ll; vector<int>a,b,c; int main() { ios_base:: sync_with_stdio(false); cin.tie(0); int n; cin>>n; int k; cin>>k; c.resize(n+1); a.resize(n+1); b.resize(n+1); for(int i=1; i<=n; i++) { cin>>a[i]; } for(int i=1; i<=n; i++) { cin>>b[i]; c[i]=abs(a[i]-b[i]); } sort(c.begin()+1,c.end()); int m=c[n/2+(n%2)]; ll sum=0; for(int i=1; i<=n; i++) { sum+=abs(c[i]-m); } cout<<sum<<endl; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...