当前位置:网站首页>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]; //表示二维数组
}
边栏推荐
- 機器人編程的培訓學科類原理
- Detailed analysis of operators i++ and ++i in JS, i++ and ++i
- About vctk datasets
- Dls-42/6-4 dc110v double position relay
- Metauniverse and virtual reality (II)
- 06. on several ways of redis persistence
- ASCII、Unicode、GBK、UTF-8之间的关系
- 使用StrictMode-StrictMode原理(1)
- Pytorch programming knowledge (2)
- C语言一点点(未来可会增加)
猜你喜欢

Shift operators
![[go] go implements row column conversion of sets](/img/d9/6272e55b2d9c6b6fbdf2537773bb83.png)
[go] go implements row column conversion of sets

ORB-SLAM2源码学习(二)地图初始化

Two position relay st2-2l/ac220v
![[network packet loss and network delay? This artifact can help you deal with everything!]](/img/c4/f733b23327458b9266b9cbcccb6f14.png)
[network packet loss and network delay? This artifact can help you deal with everything!]

二十多年来第一次!CVPR最佳学生论文授予中国高校学生!

Dls-20 double position relay 220VDC

Service

XJY-220/43AC220V静态信号继电器

Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support
随机推荐
Looksrare team's "cash out" caused disturbance
1175. Prime Arrangements
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
The liquor and tourism sector recovers, and Yaduo continues to dream of listing. How far is it from "the first share of the new accommodation economy"?
JS方法大全的一个小文档
[LeetCode] 爬楼梯【70】
06.论Redis持久化的几种方式
[问题已处理]-nvidia-smi命令获取不到自身容器的GPU进程和外部的GPU进程号
Koa koa-combine-routers 分路由管理
uniapp官方组件点击item无效,解决方案
About the general input operation mode of unity
Vnctf 2022 cm CM1 re reproduction
自定义注解实现校验
基础知识之二——STA相关的基本定义
For the first time in more than 20 years! CVPR best student thesis awarded to Chinese college students!
Why not two or four TCP handshakes
Fluent JSON serialization deserialization
[learning notes] structure
The longest selling mobile phone in China has been selling well since its launch, crushing iphone12
K210 access control complete