文章
105
粉丝
69
获赞
117
访问
58.0k
#include<bits/stdc++.h>
using namespace std;
typedef pair<int, int> PII;
const int N = 110;
PII s[N];
int n;
bool cmp(PII a, PII b)
{
if(a.second == b.second) return a.first < b.first;
else return a.second < b.second;
}
int main()
{
cin >> n;
for(int i = 0; i < n; i ++)
cin >> s[i].first >> s[i].second;
sort(s, s + n, cmp);
for(int i = 0; i < n; i ++)
cout << s[i].first << " " << s[i].second << endl;
return 0;
}
登录后发布评论
暂无评论,来抢沙发