当前位置:网站首页>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]; //表示二维数组
}
边栏推荐
- For the first time in more than 20 years! CVPR best student thesis awarded to Chinese college students!
- 关于VCTK数据集
- 5. TPM module initialization
- 基础知识之三——标准单元库
- 为什么要搭建个人博客
- Split the linked list [take next first and then cut the linked list to prevent chain breakage]
- Open3D 点云包围盒
- Installing mongodb database in Windows Environment
- Two position relay st2-2l/ac220v
- 【网络丢包,网络延迟?这款神器帮你搞定所有!】
猜你喜欢
双位置继电器DLS-5/2 DC220V
[learning notes] double + two points
Principes de formation de la programmation robotique
Koa koa combine routes sub route management
How to do the performance pressure test of "Health Code"
K210工地安全帽
Dls-42/6-4 dc110v double position relay
Docker deployment MySQL 8
【go】go 实现行专列 将集合进行转列
Practical shell knowledge
随机推荐
Exploring the road of steam education innovation in the Internet Era
DLS-20型双位置继电器 220VDC
5. TPM module initialization
图的连通性基础
None of the following candidates is applicable because of a receiver type mismatch
How to do the performance pressure test of "Health Code"
数字IC设计流程总结
StrictMode带来的思考-StrictMode原理(5)
Hoo research | coinwave production - nym: building the next generation privacy infrastructure
闭锁继电器YDB-100、100V
双位置继电器ST2-2L/AC220V
Detailed analysis of operators i++ and ++i in JS, i++ and ++i
K210工地安全帽
系统设置大页
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
DC学习笔记正式篇之零——综述与基本流程介绍
[learning notes] double + two points
[leetcode] climb stairs [70]
Service grid ASM year end summary: how do end users use the service grid?
TypeError: Argument ‘angle‘ can not be treated as a double