Submission

Status:

[PP-SS][SSSSS][SSSSSSSSSS]

Subtask/Task Score:

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

Score: 0

User: Seng

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

Language: cpp

Time: 0.002 second

Submitted On: 2026-05-26 18:04:29

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

int main(){
	ios::sync_with_stdio(0);cin.tie(0);
	map<long long, long long> m;
	int n;cin >> n;
	long long cnt = 0;
	while(n--){
		long long x, y;cin >> x >> y;
		for(int i = x; i < y; i++){
			m[i] += 1;
			cnt++;
		} 
	}
	long long i = 0;
	while(m[i] < cnt/2){
		i++;
		m[i] += m[i-1];
	}
	//cout << cnt << '\n';
	cout << i;
}