Task: | Differences |
Sender: | tykkipeli |
Submission time: | 2019-05-25 11:46:16 +0300 |
Language: | C++ |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.14 s | details |
Code
#include <bits/stdc++.h> using namespace std; typedef long long ll; int a[1010101]; int b[1010101]; int main() { int n; cin >> n; for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b[i]; } sort(a,a+n); sort(b,b+n); int ans = 0; for (int i = 0; i < n; i++) { ans += abs(a[i]-b[i]); } cout << ans << endl; }