Submission #158907

# Submission time Handle Problem Language Result Execution time Memory
158907 2019-10-19T12:16:29 Z dolphingarlic Simfonija (COCI19_simfonija) C++14
44 / 110
45 ms 2552 KB
#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 time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1144 KB Output is correct
2 Correct 37 ms 2508 KB Output is correct
3 Correct 33 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 1144 KB Output is correct
2 Correct 36 ms 2520 KB Output is correct
3 Correct 33 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 42 ms 1164 KB Output is correct
2 Correct 36 ms 2552 KB Output is correct
3 Correct 33 ms 2552 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 26 ms 1144 KB Output is correct
2 Correct 32 ms 1092 KB Output is correct
3 Incorrect 33 ms 1116 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 31 ms 1160 KB Output is correct
2 Incorrect 34 ms 1144 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 45 ms 1200 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 39 ms 1244 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 34 ms 1116 KB Output isn't correct
2 Halted 0 ms 0 KB -