Submission

Status:

[PPP-SSSSSSSSSSSSSSSSSSSSS]

Subtask/Task Score:

{0/100}

Score: 0

User: theem1502

Problemset: วันว่างๆ

Language: cpp

Time: 0.002 second

Submitted On: 2026-02-20 23:41:40

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

int main() {
    int num;
    cin >> num;
   // vector<>
    vector<pair<int,int>> sweep;
    for (int i = 0; i < num; i++) {
        int a;
        cin >> a;
        for (int j = 0; j < a; j++) {
            int tempa, tempb;
            cin >> tempa >> tempb;
          //  thearray[i].push_back(make_pair(tempa, tempb));
            sweep.push_back(make_pair(tempa, 1));
            sweep.push_back(make_pair(tempb, -1));
        }

    }

    sort(sweep.begin(), sweep.end());
    int counter = 0;
    bool thebool = false;
    for (int i = 0; i < sweep.size(); i++) {
            counter += sweep[i].second;
            if (counter == 0 && i < sweep.size()) {

                if (sweep[i+1].first == 0) {
                    continue;
                }
                  thebool = true;
                cout << sweep[i].first << " " << sweep[i+1].first << " ";
            }

    }
if (thebool == false) {
    cout << -1;

}




}