Submission #1342277

#TimeUsernameProblemLanguageResultExecution timeMemory
1342277mantaggezBest Place (NOI17_bestplace)C++20
100 / 100
27 ms2600 KiB
#include <bits/stdc++.h>

using namespace std;
using ll = long long;

struct point {
    ll x, y;
};

ll n;
vector<point> p;

ll dist(point& a, point& b) { return abs(a.x - b.x) + abs(a.y - b.y); }

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin >> n;
    for(ll i=0;i<n;i++) {
        ll x, y;
        cin >> x >> y;
        p.push_back({x, y});
    }

    point ans;
    sort(p.begin(), p.end(), [&](point& a, point& b) {
        return a.x < b.x;
    });
    ans.x = p[n / 2].x;

    sort(p.begin(), p.end(), [&](point& a, point& b) {
        return a.y < b.y;
    });
    ans.y = p[n / 2].y;

    cout << ans.x << ' ' << ans.y << '\n'; 

    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...