Task: | Differences |
Sender: | Varokaa J:tä |
Submission time: | 2019-05-25 11:21:11 +0300 |
Language: | C++ |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.07 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long int ll; int main() { cin.sync_with_stdio(false); cin.tie(nullptr); ll n; cin >> n; vector<ll> a(n), b(n); for (ll &v : a) cin >> v; for (ll &v : b) cin >> v; sort(a.begin(), a.end()); sort(b.begin(), b.end()); ll res = 0; for (int i = 0; i < n; i++) { res += abs(a[i] - b[i]); } cout << res << "\n"; }