Task: | Differences |
Sender: | Lahna |
Submission time: | 2019-05-25 11:16:30 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.14 s | details |
Code
#include <bits/stdc++.h> using namespace std; int n; vector<int> a; vector<int> b; int main(){ cin >> n; a.resize(n); b.resize(n); for (int i=0;i<n;++i) cin >> a[i]; for (int i=0;i<n;++i) cin >> b[i]; sort(a.begin(), a.end()); sort(b.begin(), b.end()); long long ts=0; for (int i=0;i<n;++i){ ts+=abs(a[i]-b[i]); } cout << ts << "\n"; }