Submission #924930

#TimeUsernameProblemLanguageResultExecution timeMemory
924930notalonebroBest Place (NOI17_bestplace)C++14
100 / 100
31 ms4748 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...