Submission

Status:

[PPP-SSSSSSSSSSSSSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: meme_boi2

Problemset: วันว่างๆ

Language: cpp

Time: 0.002 second

Submitted On: 2026-03-18 16:12:33

#include <bits/stdc++.h>
using namespace std;
#define pii array<int,2>
int32_t main(){
    cin.tie(nullptr)->sync_with_stdio(0);
    int n;
    cin >> n;
    vector<pii> mat;
    for(int i = 0; i < n; i++){
        int m;
        cin >> m;
        for(int j = 0; j < m; j++){
            pii x;
            cin >> x[0] >> x[1];
            mat.push_back(x);
        }
    }
    sort(mat.begin(),mat.end());
   // for(auto x: mat){
   //     cout << '[' << x[0] << ',' << x[1] << "] ";
  //  }
    bool chk = 0;
    pii cur = mat[0];
    for(int i = 1; i < mat.size(); i++){
        if(mat[i][0] > cur[1]){
            chk= 1;
            cout << cur[1] << ' ' << mat[i][0] << ' ';
            cur = mat[i];
        }else{
            cur[1] = mat[i][1];
        }
    }
    if(!chk) cout << -1;
}
/*
c2_st66_freeday

cd "c:\Users\RICOH-NB110\Desktop\Computer Programing\gchan\" ; if ($?) { g++ c2_st66_freeday.cpp -o c2_st66_freeday } ; if ($?) { .\c2_st66_freeday}
*/