Submission

Status:
[PPPPP][PPPPP][xSSSSSSSSS]

Score: 50

User: njoop

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

Language: cpp

Time: 0.539 second

Submitted On: 2025-03-09 23:39:19

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

int n, l, r, cnt;
vector<int> books;

signed main() {
    cin.tie(0)->sync_with_stdio(0);
    cin >> n;
    for(int i=1; i<=n; i++) {
        cin >> l >> r;
        for(int j=l; j<r; j++) {
            books.push_back(j);
        }
    }
    sort(books.begin(), books.end());
    if(books.size() == 1) cout << books[0];
    else cout << books[books.size()/2-1];
    return 0;
}