bool comp(const vector<int> & a, const vector<int> & b)
{
if (a.size() != 2 or b.size() != 2)
return false;
if (a[0] < b[0])
return true;
else if (a[0] == b[0] and a[1] > b[1])
return true;
return false;
}
int main() {
vector <vector<int>> a;
a.push_back({ 2,3 });
a.push_back({ 1,3 });
a.push_back({ 1,2 });
sort(a.begin(), a.end(), comp);
for (auto i : a)
{
for (auto j : i)
{
cout << j << " ";
}
cout << endl;
}
vector <vector<int>> tmp;
tmp.push_back(a[0]);
for (int i = 1; i < a.size(); i++)
{
auto j =tmp.back();
if (a[i][0] >= j[0] and a[i][1] <= j[1])
continue;
else
tmp.push_back(a[i]);
}
cout << endl;
for (auto i : tmp)
{
for (auto j : i)
{
cout << j << " ";
}
cout << endl;
}
return 0;
}