Submission #158907

#TimeUsernameProblemLanguageResultExecution timeMemory
158907dolphingarlicSimfonija (COCI19_simfonija)C++14
44 / 110
45 ms2552 KiB
#include <bits/stdc++.h> #define FOR(i, x, y) for (ll i = x; i < y; i++) typedef long long ll; using namespace std; ll d[100000]; int main() { ios_base::sync_with_stdio(0); cin.tie(0); ll n, k; cin >> n >> k; FOR(i, 0, n) cin >> d[i]; FOR(i, 0, n) { ll x; cin >> x; d[i] -= x; } sort(d, d + n); ll x = d[n / 2]; FOR(i, 0, n) { d[i] -= x; d[i] = abs(d[i]); } sort(d, d + n); ll ans = 0; FOR(i, 0, n - k) ans += d[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...