Submission

Status:

[PPPPP][PPPPP][xSSSSSSSSS]

Subtask/Task Score:

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

Score: 50

User: hanapiyajong

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

Language: cpp

Time: 0.265 second

Submitted On: 2026-03-10 20:39:15

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

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