奇怪的评测机
查看原帖
奇怪的评测机
1175010
AlanWalker_1楼主2024/10/25 18:12

为什么我下载数据后,本地测试结果和luogu测试结果不一样? 输入

2

45 28 100 100

57 52 92 3

45 28

本地输出(预期输出):1

luogu输出:-1

record

code:

#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int> PII;
inline int read(){
	char ch=10;
	int x=0;
	while(ch==' ' || ch==10 || ch==EOF) ch=getchar();
	while(ch!=' ' && ch!=10 && ch!=EOF) x=(x<<1)+(x<<3)+ch-'0',ch=getchar();
	return x;
}
pair<PII,PII> b[10002]; 
int main(){
	int n=read();
	int ans=-1;
	for(int i=1;i<=n;i++) b[i]={{read(),read()},{read(),read()}};
	int x=read(),y=read();
	for(int cnt=1;cnt<=n;cnt++){
		pair<PII,PII> a=b[cnt];
		int sx=a.first.first,sy=a.first.second,l=a.second.first,w=a.second.second;
		int ex=sx+l,ey=sy+w;
		if(sx<=x && ex>=x && sy<=y && ey>=y) ans=max(ans,cnt);
		cnt++;
	}
	cout<<ans;
	return 0;
}
2024/10/25 18:12
加载中...