# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
481511 | Swarnava_Chattaraj | Best Place (NOI17_bestplace) | C++17 | 97 ms | 3012 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;
#define ll long long int
void solve()
{
int n;
cin >> n;
int maxi_x = 0, maxi_y = 0;
int mini_x = INT_MAX, mini_y = INT_MAX;
vector<int> X(n);
vector<int> Y(n);
for(int i = 0; i < n; i++)
{
cin >> X[i] >> Y[i];
}
sort(X.begin(), X.end());
sort(Y.begin(), Y.end());
int m_x = 0, m_y = 0;
if(n % 2 != 0)
m_x= X[n / 2];
else
m_x = (X[(n - 1) / 2] + X[(n + 1) / 2]) / 2;
if(n % 2 != 0)
m_y= Y[n / 2];
else
m_y = (Y[(n - 1) / 2] + Y[(n + 1) / 2]) / 2;
cout << m_x << ' ' << m_y << endl;
}
int main(){
// #ifndef ONLINE_JUDGE
// freopen("input.txt","r",stdin);
// freopen("output.txt","w",stdout);
// #endif
// // ll T;
// // cin >> T;
// // while(T--)
// // {
// // solve();
// // }
solve();
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... |