当前位置:网站首页>sort自定义函数
sort自定义函数
2022-07-01 00:41:00 【未央吖】
定义一个二维数组
vector<vector<int>> ret;
(1)按二维数组ret[i][1]的大小排列从大到小
static bool cmp(vector<int> &m, vector<int> &n) {
retutn m[1] > n[1]; //表示二维数组
}
sort(ret.begin(), ret.end(), cmp)
(2)按二维数组ret[i][1]的大小排列从小到大 (力扣平台不用static会出错,sort要求要static)
static bool cmp(vector<int> &m, vector<int> &n) {
retutn m[1] < n[1]; //表示二维数组
}
边栏推荐
- DX-11Q信号继电器
- 解决IDEA:Class ‘XXX‘ not found in module ‘XXX‘
- 友盟(软件异常实时监听的好帮手:Crash)接入教程(有点基础的小白最易学的教程)
- Basic knowledge of software and hardware -- diary (1)
- For the first time in more than 20 years! CVPR best student thesis awarded to Chinese college students!
- Metauniverse and virtual reality (II)
- Tcp/ip protocol stack, about TCP_ RST | TCP_ ACK correct attitude
- [问题已处理]-nvidia-smi命令获取不到自身容器的GPU进程和外部的GPU进程号
- Inspire students' diversified thinking with steam Education
- Docker 部署 MySQL 8
猜你喜欢

Pre training / transfer learning of models

Service

解析融合学科本质的创客教育路径

Install redis database and download redis Desktop Manager in win11

Packing and unpacking of C #

Orb-slam2 source code learning (II) map initialization

Practical shell knowledge

DLS-42/6-4 DC110V双位置继电器
![Parity linked list [two general directions of linked list operation]](/img/4e/ce860bc172bb75f456427ba26a7842.png)
Parity linked list [two general directions of linked list operation]

XJY-220/43AC220V静态信号继电器
随机推荐
DC學習筆記正式篇之零——綜述與基本流程介紹
[LeetCode] 爬楼梯【70】
[leetcode] climb stairs [70]
【学习笔记】倍增 + 二分
The real topic of the 11th provincial competition of Bluebridge cup 2020 - crop hybridization
User defined annotation implementation verification
Open3D 点云包围盒
ASCII、Unicode、GBK、UTF-8之间的关系
Tcp/ip protocol stack, about TCP_ RST | TCP_ ACK correct attitude
图的连通性基础
Interpreting the scientific and technological literacy contained in maker Education
WIN11中MathType编辑中“打开数学输入面板”是灰色不可编辑
友盟(软件异常实时监听的好帮手:Crash)接入教程(有点基础的小白最易学的教程)
TCP三次握手为什么不是两次或四次
(learning power + thinking power) x action power, summary of flywheel effect on the growth of technicians
Introduction and principle analysis of cluster and LVS
Technical personnel advanced to draw a big picture of business, hand-in-hand teaching is coming
pull_ to_ refresh
C语言一点点(未来可会增加)
Gavin's insight on the transformer live broadcast course - rasa project's actual banking financial BOT Intelligent Business Dialogue robot system startup, language understanding, dialogue decision-mak