30% n<=2
50% 0<=a,b,g,k<=100
100% 0<=n<=10000, 0<=a,b,g,k<=100000
这道题感谢黄学长的代码,感谢hzwer~~~~~~
好吧,我承认这道题很水
#include<iostream> using namespace std; int main() { int n,a[10001],b[10001],g[10001],k[10001],xi,yi; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i]>>b[i]>>g[i]>>k[i]; } cin>>xi>>yi; for(int i=n;i>0;i--) { if(a[i]<=xi&&a[i]+g[i]>=xi&&b[i]<=yi&&b[i]+k[i]>=yi) { cout<<i; return 0; } } cout<<-1; return 0; }
时间: 2025-01-01 08:39:11