| 比赛 | NOIP模拟赛by mzx Day1 | 评测结果 | AAAAAAAAAE | 
    | 题目名称 | 为爱追寻 | 最终得分 | 90 | 
    | 用户昵称 | ONCE AGAIN | 运行时间 | 4.795 s | 
    | 代码语言 | C++ | 内存使用 | 34.62 MiB | 
    | 提交时间 | 2016-10-19 19:27:16 | 
显示代码纯文本
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int maxn = 6000;
const int BIT = 3000;
bool Flag[maxn][maxn] = {0};
typedef long long LL;
LL N,lx,ly,tx,rx,ry,ans = 0;
int main(){
	freopen("loverfinding.in","r",stdin);
	freopen("loverfinding.out","w",stdout);
	scanf("%lld%lld%lld%lld%lld",&N,&lx,&ly,&rx,&ry);
	ans++ ;
	if(lx == rx&&ly == ry){
		printf("1");
		return 0;	
	}
	Flag[lx+BIT][ly+BIT] = true;
	LL a,b;
	for(int i = 1;i<=N;i++){
		scanf("%lld%lld",&a,&b);
		lx+=a;
		ly+=b;
		if(!Flag[lx+BIT][ly+BIT])ans++,Flag[lx+BIT][ly+BIT] = true;
		if(lx == rx&&ly == ry){
			printf("%lld",ans);
			return 0;	
		}
	}
	printf("SingleDogMZX\n");
	return 0;
}