比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 LCWhiStLe 运行时间 10.028 s
代码语言 C++ 内存使用 246.36 MiB
提交时间 2016-10-19 20:55:47
显示代码纯文本
#include<queue>
#include<cstdio>
#include<iostream>
#define MAXN 1000010
#define INF 250000000
#define MOD 99999991
using namespace std;
int n,x0,y0,x1,y1,ans;
int h1=41,h2=37;
int a[MAXN],b[MAXN];
bool h[INF],flag;
struct node {
	int x;
	int y;
};
inline void read(int&x) {
	int f=1;x=0;char c=getchar();
	while(c>'9'||c<'0') {if(c=='-') f=-1;c=getchar();}
	while(c>='0'&&c<='9') x=10*x+c-48,c=getchar();
	x*=f;
}
inline bool ha(int x,int y) {
	x*=h1;y*=h2;
	int t=x%MOD;
	t+=y%MOD;
	if(t<0) t+=INF;
	if(h[t]) return false;
	h[t]=true;
	return true;
}
int main() {
	freopen("loverfinding.in","r",stdin);
	freopen("loverfinding.out","w",stdout);
	int a,b;
	read(n);read(x0);read(y0);read(x1);read(y1);
	ha(x0,y0);ans++;
	for(int i=1;i<=n;i++) {
		read(a);read(b);
		x0+=a;y0+=b;
		if(x0==x1&&(y0==y1)) {
			flag=true;
			ans++;
			break;
		}
		if(ha(x0,y0)) ans++;
	}
	if(flag) printf("%d\n",ans);
	else printf("SingleDogMZX\n");
	return 0;
}