Submission #924930

# Submission time Handle Problem Language Result Execution time Memory
924930 2024-02-10T05:10:27 Z notalonebro Best Place (NOI17_bestplace) C++14
100 / 100
31 ms 4748 KB
#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
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 460 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2652 KB Output is correct
2 Correct 20 ms 3932 KB Output is correct
3 Correct 28 ms 3956 KB Output is correct
4 Correct 16 ms 3928 KB Output is correct
5 Correct 19 ms 3928 KB Output is correct
6 Correct 20 ms 3932 KB Output is correct
7 Correct 21 ms 3912 KB Output is correct
8 Correct 21 ms 3928 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 1 ms 344 KB Output is correct
6 Correct 0 ms 460 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 ms 848 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 29 ms 2664 KB Output is correct
2 Correct 31 ms 4688 KB Output is correct
3 Correct 21 ms 4696 KB Output is correct
4 Correct 27 ms 3932 KB Output is correct
5 Correct 30 ms 4748 KB Output is correct
6 Correct 29 ms 4700 KB Output is correct
7 Correct 29 ms 4688 KB Output is correct
8 Correct 29 ms 4688 KB Output is correct