CSES - HIIT Open 2019 - Results
Submission details
Task:Differences
Sender:tykkipeli
Submission time:2019-05-25 11:46:16 +0300
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.14 sdetails

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;
}

Test details

Test 1

Verdict:

input
100000
880024238 421943433 201872615 ...

correct output
79489641069

user output
-2114737555