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 <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using ll = long long;
ll median(vector<ll> nums) {
sort(nums.begin(), nums.end());
ll n = nums.size();
if (n % 2 != 0) {
return nums[n / 2];
} else {
return (nums[(n - 1) / 2] + nums[n / 2]) / 2; // Keep as integer division for your case
}
}
void solve() {
ll n;
cin >> n;
vector<ll> x, y;
x.reserve(n);
y.reserve(n);
for (ll i = 0; i < n; i++) {
ll a, b;
cin >> a >> b;
x.push_back(a);
y.push_back(b);
}
ll medx = median(x);cout<<medx<<" ";
ll medy = median(y);cout<<medy;
}
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
solve();
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... |