| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 320748 | egas | Best Place (NOI17_bestplace) | C++14 | 41 ms | 2184 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
long long getManHat(long long x, vector<long long> &a) {
    long long res=0;
    for(long long i = 0 ; i < a.size() ; i++) {
        res+=abs(x-a[i]);
    }
    return res;
}
int32_t main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    long long n;
    cin >> n;
    vector<long long> X,Y;
    for(long long i = 0 ; i < n ; i++) {
        long long x;
        cin >> x;
        long long y;
        cin >> y;
        X.push_back(x);
        Y.push_back(y);
    }
    sort(X.begin(),X.end());
    sort(Y.begin(),Y.end());
    long long resx;
    if(n%2==0) {
        if(getManHat(X[X.size()/2],X)<getManHat(X[(X.size()/2)-1],X)) {
            resx=X[X.size()/2];
        } else {
            resx=X[(X.size()/2)-1];
        }
    } else {
        resx=X[X.size()/2];
    }
    long long resy;
    if(n%2==0) {
        if(getManHat(Y[Y.size()/2],Y)<getManHat(Y[(Y.size()/2)-1],Y)) {
            resy=Y[Y.size()/2];
        } else {
            resy=Y[(Y.size()/2)-1];
        }
    } else {
        resy=Y[Y.size()/2];
    }
    cout << resx << ' ' << resy << '\n';
    return 0;
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
