文章
34
粉丝
316
获赞
10
访问
22.3k
#include<bits/stdc++.h>
using namespace std;
int cmp(pair<int, int>a, pair<int, int >b)
{
if (a.second == b.second) return a.first < b.first;
else return a.second < b.second;
}
int main()
{
int n;
cin >>n;
vector<pair<int, int>>data;
int a, b;
for (int i = 0; i < n; i++)
{
cin >> a >> b;
pair<int, int> new_pair;
new_pair.first = a;
new_pair.second = b;
data.push_back(new_pair);
}
sort(data.begin(), data.end(), cmp);
//打印结果
for (int i = 0; i < n; i++...
登录后发布评论
暂无评论,来抢沙发