文章
1
粉丝
191
获赞
0
访问
490
#include<iostream>
#include<set>
using namespace std;
struct compare {
bool operator()(const pair<int, int>& a, const pair<int, int>& b)const
{
if (a.second == b.second)
return a.first < b.first;
else
return a.second < b.second;
}
};
int main()
{
int n;
cin >> n;
set<pair<int, int>, compare> myset;
for (int i = 0; i < n; i++)
{
int a, b;
cin >> a >> b;
myset.insert(make_pair(a, b));
}
for (auto& a : myset)
{
cout << a.first << " " << a.second << end...
登录后发布评论
暂无评论,来抢沙发