//第一题代码 #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

相关推荐

26届双非不知道咋找得到实习了
kong_kong:1.广投,boss每天200次机会用完, 2.简历上技能和项目经历突出你在这个岗位上的突出优势。 3.还是广投,不要挑地点,公司规模(我当时是线下一个都不去,如果你离得近可以考虑一下去现场) 4.简历写的自己成绩好什么的,奖项也写一写(懂的都懂)
点赞 评论 收藏
分享
牛客网
牛客企业服务