提交时间:2023-08-25 11:03:57
运行 ID: 100310
#include<bits/stdc++.h> using namespace std; int a[114514],b[114514],c[114514]; int main(){ int n; cin>>n; for (int i = 1;i <= n;i++){ cin>>a[i]>>b[i]>>c[i]; } a[0] = -1,b[0] = -0x3f3f3f3f,c[0] = 0x3f3f3f3f; for (int i = 1;i <= n;i++){ int x = -2,xx = -2,y = -2,yy = -2; for (int j = 1;j <= n;j++){ if (a[j] < a[i] && b[j] < b[i] && c[j] >= b[i]){ if (a[j] > xx){ x = j; xx = a[j]; } } } cout<<max(x,0)<<' '; for (int j = 1;j <= n;j++){ if (a[j] < a[i] && b[j] <= c[i] && c[j] > c[i]){ if (a[j] > yy){ y = j; yy = a[j]; } } } cout<<max(y,0)<<'\n'; } return 0; }