Day6-T1
Describe:模拟大水题
code:
#include<bits/stdc++.h> #define INF 214748364 #define eps 1e-9 #define rep1(a,b) for(register long long i=(a);i<=(b);i++) #define rep2(a,b) for(register long long j=(a);j<=(b);j++) using namespace std; struct JXCjulao{ long long x1,x2,y1,y2; }a[100110]; long long n,x,y; inline long long read(){ long long ret=0,f=1;char ch=getchar(); while (ch<'0'||ch>'9') {if (ch=='-') f=-f;ch=getchar();} while (ch>='0'&&ch<='9') ret=ret*10+ch-'0',ch=getchar(); return ret*f; } inline double read2(){ double X=0,Y=1.0;long long w=0;char ch=0; while(!isdigit(ch)){w|=ch=='-';ch=getchar();} while(isdigit(ch))X=X*10+(ch^48),ch=getchar(); ch=getchar(); while(isdigit(ch)) X+=(Y/=10)*(ch^48),ch=getchar(); return w?-X:X; } inline void write(long long x){ if(x<0){putchar('-');write(-x);return;} if(x/10) write(x/10);putchar(x%10+'0'); } int main(){ //freopen("carpet.in","r",stdin); //freopen("carpet.out","w",stdout); n=read(); for(int i=1;i<=n;i++)a[i].x1=read(),a[i].y1=read(),a[i].x2=read()+a[i].x1,a[i].y2=read()+a[i].y1; //求地毯坐标 x=read(),y=read();for(int i=n;i>=1;i--)if(x<=a[i].x2&&x>=a[i].x1&&y<=a[i].y2&&y>=a[i].y1){cout<<i;return 0;} //从后向前找符合条件的地毯 cout<<-1;return 0; //找不到puts(0); }