为什么要对.id排序
查看原帖
为什么要对.id排序
481337
Pratty楼主2023/9/24 11:33

struct 结构如下:

struct node {
  int id, num;
}a[N];

cmp 结构如下:

bool cmp(node a, node b) {
  return a.num == b.num ? a.id < b.id : a.num < b.num;
}

cmp 为什么要对 .id 排序,而且题目给的排序中似乎也没有按先后排序啊?

2023/9/24 11:33
加载中...