题解
2025-06-09 23:28:45
发布于:江苏
37阅读
0回复
0点赞
#include<iostream>
#include<algorithm>
using namespace std;
struct pineapple{
int x,y,id;
}k[1000010];
bool cmp(pineapple l,pineapple r){
if(l.x!=r.x){
return l.x>r.x;
}else if(l.y!=r.y){
return l.y<r.y;
}else{
return l.id<r.id;
}
}
int main(){
int n,a,b,cnt=0;
cin>>n>>a>>b;
for(int i=0;i<n;i++){
int X,Y;
cin>>X>>Y;
if(X>=a&&Y<=b){
k[cnt].x=X;
k[cnt].y=Y;
k[cnt].id=i+1;
cnt++;
}
}
sort(k,k+cnt,cmp);
for(int i=0;i<cnt;i++){
cout<<k[i].id<<' ';
}
return 0;
}
这里空空如也
有帮助,赞一个