#include<bits/stdc++.h>
using namespace std;
struct platform{
int h,l,r;
};
int main (){
int N;
cin>>N;
platform p[N];
for(int i=1;i<=N;i++){
cin>>p[i].h>>p[i].l>>p[i].r;
}
for(int i=1;i<=N;i++){
int left=0,right=0;
for(int j=1;j<=N;j++){
if(p[j].h<p[i].h&&p[j].l<p[i].l&&p[j].r>p[i].l){
if(p[left].h<p[j].h)left=j;
}
}
cout<<left<<" ";
for(int j=1;j<=N;j++){
if(p[j].h<p[i].h&&p[j].l<p[i].r&&p[j].r>p[i].r){
if(p[right].h<p[j].h)right=j;
}
}
cout<<right<<endl;
}
return 0;
}
以上代码提交WA得80 但把结构体改成这样就对了
struct platform{
int h=0,l=0,r=0;
};
不解