Submission #225061

# Submission time Handle Problem Language Result Execution time Memory
225061 2020-04-19T08:48:00 Z VEGAnn Simfonija (COCI19_simfonija) C++14
44 / 110
49 ms 1664 KB
#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];

    qr.clear();

    for (int i = 0; i < n; i++)
        qr.PB(abs(a[i] - cur - b[i]));

    sort(all(qr));

    for (int it = 0; it + k < n; it++)
        ans += qr[it];

    cout << ans;

    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Correct 4 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 49 ms 1656 KB Output is correct
2 Correct 42 ms 1664 KB Output is correct
3 Correct 41 ms 1664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1664 KB Output is correct
2 Correct 43 ms 1664 KB Output is correct
3 Correct 36 ms 1656 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1664 KB Output is correct
2 Correct 42 ms 1664 KB Output is correct
3 Correct 37 ms 1664 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 1664 KB Output is correct
2 Correct 36 ms 1664 KB Output is correct
3 Incorrect 39 ms 1664 KB Output isn't correct
# Verdict Execution time Memory Grader output
1 Incorrect 48 ms 1656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 35 ms 1664 KB Output is correct
2 Incorrect 38 ms 1664 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 47 ms 1656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 46 ms 1656 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 42 ms 1656 KB Output isn't correct
2 Halted 0 ms 0 KB -