Submission #224957

#TimeUsernameProblemLanguageResultExecution timeMemory
224957VEGAnnSimfonija (COCI19_simfonija)C++14
44 / 110
42 ms3104 KiB
#include <bits/stdc++.h> #define MP make_pair #define PB push_back #define ft first #define sd second #define all(x) x.begin(),x.end() using namespace std; typedef long long ll; const int N = 100100; vector<int> qr; int n, k, a[N], b[N]; int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k; for (int i = 0; i < n; i++) cin >> a[i]; for (int j = 0; j < n; j++){ cin >> b[j]; qr.PB(a[j] - b[j]); } ll ans = 0; sort(all(qr)); ll cur = qr[n / 2]; for (int i = 0; i < n; i++) ans += abs(a[i] - cur - b[i]); cout << ans; 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...