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;
typedef long long int ll;
#define all(x) x.begin(), x.end()
ll n;
int oned(vector<ll> d) {
if (n%2 == 1) {
int mid = floor(n/2);
return d[mid];
} else {
int mid = floor(( (n/2) + (n/2) -1 )/2);
return d[mid];
}
return 0;
}
int solver() {
cin>>n ;
vector<ll> x(n), y(n);
for(int i = 0; i< n; i++) {
cin>> x[i] >> y[i];
}
sort(all(x)); sort(all(y));
if (equal(x.begin()+1 , x.end(), x.begin())) {
cout<< x[0] <<" "<< oned(y) << "\n";
return 0;
} else if(equal(y.begin()+1, y.end(), y.begin())) {
cout<< oned(x)<< " "<< y[0] << "\n";
return 0;
}
if (n%2 == 1) {
ll mX = x[n/2];
ll mY = y[n/2];
cout<< mX << " " << mY << "\n";
return 0;
} else {
int mid = floor(( (n/2) + (n/2) -1 )/2);
ll mX = x[mid];
ll mY = y[mid];
cout<< mX << " " << mY << "\n";
return 0;
}
return 0;
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solver();
return 0;
}
# | 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... |