//第一题代码 #include<bits/stdc++.h> using namespace std; const int maxn = 5*1e5 + 10; struct node{     int x,y;     bool operator < (const node &b)const{         if(x == b.x) return y > b.y;         return x > b.x;     } }T[maxn]; node tmp[maxn]; int main(){     int n,cnt = 0;     scanf("%d",&n);     for(int i = 0; i < n; i++)         scanf("%d%d",&T[i].x,&T[i].y);     sort(T,T+n);     int tmp_y = -1;     for(int i = 0; i < n; i++){         if(T[i].y >= tmp_y){             tmp[cnt].x = T[i].x;             tmp[cnt].y = T[i].y;             tmp_y = T[i].y;             cnt++;         }     }     for(int i = cnt-1; i >= 0; i--){         printf("%d %d\n",tmp[i].x,tmp[i].y);     } }
点赞 2

相关推荐

07-14 13:47
门头沟学院 Java
Lynn012:你评估好自己的位置了吗《顶尖应届》
投递小米集团等公司7个岗位
点赞 评论 收藏
分享
点赞 评论 收藏
分享
机械打工仔:有说的你怀疑一下就行了,直接问也太实诚了
点赞 评论 收藏
分享
彧未sr:查看图片
投递牧原集团等公司7个岗位
点赞 评论 收藏
分享
牛客网
牛客网在线编程
牛客网题解
牛客企业服务