结构体重载
#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 10;
struct node
{
int x, y;
node(int xx = 0, int yy = 0) : x(xx), y(yy) {}
bool operator<(const node &a) const
{
if (x == a.x)
return y < a.y;
return x < a.x;
}
} a[N];
map<struct node, struct node> mp;
signed main()
{
int n;
cin >> n;
for (int i = 0; i < n; i++)
{
int x, y;
cin >> x >> y;
a[i] = node(x, y);
if (i)
mp[a[i - 1]] = a[i];
}
sort(a, a + n);
for (int i = 0; i < n; i++)
cout << a[i].x << " " << a[i].y << endl;
}