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;
using ll = long long;
int main() {
ios_base::sync_with_stdio(false);cin.tie(0);
ll N;
cin>>N;
ll arr[N];
ll arr2[N];
for(ll i = 0;i < N;i++){
ll a,b;
cin>>a>>b;
arr[i] = a;
arr2[i] = b;
// arr[i].second.first = a;
// arr[i].second.second = b;
// arr[i].first = a + b;
}
sort(arr,arr + N);
sort(arr2,arr2 + N);
if(N % 2 == 0){
ll sum1 = (arr[(N / 2) - 1] + arr[(N / 2)]) / 2;
ll sum2 = (arr2[(N / 2) - 1] + arr2[(N / 2)]) / 2;
//ll sum1 = (arr[(N / 2) - 1].second.first + arr[(N / 2)].second.first) / 2;
//ll sum2 = (arr[(N / 2) - 1].second.second + arr[(N / 2)].second.second) / 2;
cout<<sum1<<" "<<sum2<<'\n';
}else if(N % 2 == 1){
//cout<<N / 2<<'\n';
ll sum1 = arr[N / 2];
ll sum2 = arr2[N / 2];
cout<<sum1<<" "<<sum2<<'\n';
}
}
# | 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... |