Submission
Status:
[PPPP-][SSSSS][SSSSSSSSSS]
Subtask/Task Score:
{0/20}{0/30}{0/50}
Score: 0
User: 666whynot
Problemset: ห้องสมุดเมือง 3M
Language: cpp
Time: 0.002 second
Submitted On: 2025-09-23 16:51:41
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);cin.tie(nullptr);
int n;cin >> n;
vector<int> v;
while(n--){
int x,y;cin >> x >> y;
if(x < y)for(int i=x;i<y;i++){
v.push_back(i);
}
if(v.empty())return 0;
}
sort(v.begin(),v.end());
int a = v.size() / 2;
if(v.size() % 2 == 0){
cout << (v[a-1] + v[a]) / 2;
}
else cout << v[a];
}