当前位置:网站首页>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]; //表示二维数组
}
边栏推荐
猜你喜欢

Principes de formation de la programmation robotique

Call the classic architecture and build the model based on the classic

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

软硬件基础知识学习--小日记(1)

WIN11中MathType编辑中“打开数学输入面板”是灰色不可编辑

双位置继电器DLS-5/2 DC220V

Unhandled Exception: MissingPluginException(No implementation found for method launch on channel)

Share your own terminal DIY display banner

Day31-t1380-2022-02-15-not answer by yourself

Hoo research | coinwave production - nym: building the next generation privacy infrastructure
随机推荐
How to scroll uitableview to a specific position - how to scroll uitableview to specific position
Service grid ASM year end summary: how do end users use the service grid?
pull_ to_ refresh
Training discipline principle of robot programming
Call the classic architecture and build the model based on the classic
酒旅板块复苏,亚朵继续上市梦,距离“新住宿经济第一股“还有多远?
Chromatic judgement bipartite graph
Basic knowledge of software and hardware -- diary (1)
TypeError: Argument ‘angle‘ can not be treated as a double
StrictMode分析Activity泄漏-StrictMode原理(3)
Xjy-220/43ac220v static signal relay
Kongyiji's first question: how much do you know about service communication?
New content violation degree determination scana bad information monitoring capability update issue 5
Tcp/ip protocol stack, about TCP_ RST | TCP_ ACK correct attitude
Web interface testing of software testing
[learning notes] double + two points
Koa koa combine routes sub route management
Flutter Error: Cannot run with sound null safety, because the following dependencies don‘t support
【学习笔记】简单dp
用recyclerReview展示Banner,很简单