Submission

Status:

[PPPPP][PPPPP][xSSSSSSSSS]

Subtask/Task Score:

{20/20}{30/30}{0/50}

Score: 50

User: hanapiyajong

Problemset: ห้องสมุดเมือง 3M

Language: cpp

Time: 0.225 second

Submitted On: 2026-03-10 20:34:17

#include <bits/stdc++.h>
using namespace std;

int main() {
    ios_base::sync_with_stdio(0),cin.tie(0);
    long long n;
    if (!(cin >> n))
    {
        return 0;
    }

    long long a,b;
    vector<long long> v;
    long long mn=INT_MAX,mx = INT_MIN;
    for (int i = 0; i < n; i++){
        cin >> a >> b;
        for (int i = a; i < b; i++) v.push_back(i);
    }
    sort(v.begin(),v.end());
    long long med = (v.size())/2;
    if(med<=0) cout << v[0];
    else cout << v[med-1];
}