| 比赛 | NOIP模拟赛by mzx Day1 | 评测结果 | AAAAAAAAAE | 
    | 题目名称 | 为爱追寻 | 最终得分 | 90 | 
    | 用户昵称 | 槿柒 | 运行时间 | 4.977 s | 
    | 代码语言 | C++ | 内存使用 | 24.23 MiB | 
    | 提交时间 | 2016-10-19 19:17:31 | 
显示代码纯文本
#include<cstdio>
#include<algorithm>
#include<cstring>
#define INF 2502
using namespace std;
const int maxn=5010;
int n,x0,y0,x1,y1,dx,dy,ans=0;
bool f[5010][5010]={0};
int main()
{
	freopen("loverfinding.in","r",stdin);
	freopen("loverfinding.out","w",stdout);
	scanf("%d%d%d%d%d",&n,&x0,&y0,&x1,&y1);
	if(x0==x1 && y0==y1){puts("1");return 0;}
	ans++;f[x0+INF][y0+INF]=1;
	for(int i=1;i<=n;i++){
		scanf("%d%d",&dx,&dy);
		x0=dx+x0,y0=dy+y0;
		if(x0==x1 && y0==y1){
			ans++;
			printf("%d\n",ans);
			return 0;
		}
		else if(!f[x0+INF][y0+INF]){
			f[x0+INF][y0+INF]=1;
			ans++;
		}
	}
	printf("SingleDogMZX\n");
	return 0;
}