哪位大佬帮我看看(WA八个)
  • 板块P1105 平台
  • 楼主HTML19990601
  • 当前回复2
  • 已保存回复2
  • 发布时间2025/2/5 20:03
  • 上次更新2025/2/6 02:01:53
查看原帖
哪位大佬帮我看看(WA八个)
1546843
HTML19990601楼主2025/2/5 20:03
#include<bits/stdc++.h>

using namespace std;

int list1[3][1001];
int n;

int main(){
	cin >> n;
	for(int i = 1;i<=n;i++){
		cin >> list1[0][i] >> list1[1][i] >> list1[2][i];
	}
	for(int i = 1;i<=n;i++){
		int best = -1;
		int h = list1[0][i],l=list1[1][i],r=list1[2][i];
		for(int j = 1;j<=n;j++){
			int h2 = list1[0][j],l2=list1[1][j],r2=list1[2][j];
			if(h2>=h){
				if(j!=n) continue;
				cout << 0 << " ";
				continue;
			}
			if(l2<l and r2>l){
				if(best == -1){
					best = j;
				}
				if(list1[0][best] < list1[0][j]){
					best = j;
				}
			}
			if(j!=n) continue;
			if(best!=-1){
				cout << best << " ";
				break;
			}
			cout << 0 << " ";
		}
	best = -1;
	for(int j = 1;j<=n;j++){
		int h2 = list1[0][j],l2=list1[1][j],r2=list1[2][j];
			if(h2>=h){
				if(j!=n) continue;
				cout << 0;
				continue;
			}
			if(l2<r and r2>r){
				if(best == -1){
					best = j;
				}
				if(list1[0][best] < list1[0][j]){
					best = j;
				}
			}
			if(j!=n) continue;
			if(best!=-1){
				cout << best;
				break;
			}
			cout << 0;
		}
		
	if(i!=n){
		cout<< endl;
	}	
		
	}
	
	return 0;
}
2025/2/5 20:03
加载中...