按照元素的第一顺序排序 // maybe贪心会用到
struct ty{
int x, y;
}a[N];
bool cmp(ty a, ty b)
{
if (a.x < b.x) return true;
return false;
}
int main()
{
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> a[i].x >> a[i].y;
}
sort(a + 1, a + n + 1, cmp);
return 0;
}
标签:return,第一,ty,int,元素,排序,cmp
From: https://www.cnblogs.com/Liserpuler/p/17798707.html