Submission

Status:

[PPPPPPPPPPPPPPPPPPPPPPP-S]

Subtask/Task Score:

{0/100}

Score: 0

User: achinhchin

Problemset: วันว่างๆ

Language: cpp

Time: 0.014 second

Submitted On: 2026-02-25 22:49:26

#include<iostream>
#include<iterator>
#include<map>
#define f first
#define s second
using namespace std;
typedef long long l;
map<l,l>A;
l n,tn,a,b,t;
bool c;
int main(){
  cin.tie(nullptr)->sync_with_stdio(0);
  cin>>n;while(n--){
    cin>>tn;while(tn--)cin>>a>>b,A[a]++,A[b]--;
  }for(auto i=A.begin();i!=prev(A.end());i++){
    t+=i->s;
    //cout<<i->f<<' '<<i->s<<' '<<t<<'\n';
    if(!t)cout<<i->f<<' ',c=1;
    else if(c)cout<<i->f<<' ',c=0;
  }
}