Submission

Status:

[PPPPP][PPPPP][xSSSSSSSSS]

Subtask/Task Score:

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

Score: 50

User: NovemNotes

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

Language: cpp

Time: 0.221 second

Submitted On: 2026-03-11 10:56:30

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

using ll = long long;

ll n;
vector<ll> v;


int32_t main(){
    ios_base::sync_with_stdio(false);cin.tie(NULL);
    cin >> n;
    for(ll i=0;i<n;i++){
        int a,b;cin >> a >> b;
        for(ll j=a;j<b;j++){
            v.emplace_back(j);
        }
    }
    sort(v.begin(),v.end());
    ll sz = v.size();
    // for(auto &x:v)cout << x << " " ;
    // cout << "\n";
    if(sz==1)cout << v[0] << "\n";
    else cout << v[sz/2-1] << "\n";
    return 0;
}