이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... |