Submission
Status:
[PPPPPPPPPPPPPPPPPPPPPPPPP]
Subtask/Task Score:
{100/100}
Score: 100
User: mightbeputter
Problemset: วันว่างๆ
Language: cpp
Time: 0.014 second
Submitted On: 2026-03-27 14:15:59
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
map<int, int> mp;
int main(){
cin.tie(nullptr)->sync_with_stdio(false);
int n;
cin >> n;
for(int i=1;i<=n;i++){
int m;
cin >> m;
for(int j=1;j<=m;j++){
int st,en;
cin >> st >> en;
mp[st] += 1;
mp[en] += -1;
}
}
int last = -1, cnt = 0;
bool ch = false;
for(auto& x : mp){
if(cnt == 0 && last != -1) cout << last << " " << x.first << " ", ch = true;
last = x.first;
cnt += x.second;
}
if(!ch) cout << "-1";
return 0;
}