比赛 |
NOIP模拟赛by mzx Day1 |
评测结果 |
TTTTTTTTTT |
题目名称 |
为爱追寻 |
最终得分 |
0 |
用户昵称 |
Hzoi_Yniverse |
运行时间 |
10.044 s |
代码语言 |
C++ |
内存使用 |
0.31 MiB |
提交时间 |
2016-10-19 21:43:13 |
显示代码纯文本
#include <iostream>
#include <cstdio>
#include <cstring>
#include <algorithm>
#include <map>
using namespace std;
struct Node{
int x,y;
Node(int a,int b){ x=a; y=b; }
bool operator<(const Node &a)const{
if(x==a.x) return y<a.y;
return x<a.x;
}
};
map<Node,bool> mp;
int main(){
freopen("loverfinding.in","r",stdin);
freopen("loverfinding.out","w",stdout);
int n,x1,y1,x2,y2;
scanf("%d%d%d%d%d",&n,&x1,&y1,&x2,&y2);
if(x1==x2&&y1==y2){ printf("1\n"); return 0; }
int x=x1,y=y1,ans=0; bool ok=0;
mp[Node(x,y)]=1; ans++;
for(int i=1;i<=n;i++){
int xx,yy;scanf("%d%d",&xx,&yy);
x+=xx; y+=yy;
if(!mp.count(Node(x,y))){
mp[Node(x,y)]=1;
ans++;
}
if(x==x2&&y==y2){ ok=1; break; }
}
if(ok) printf("%d\n",ans);
else printf("SingleDogMZX\n");
//system("pause");
return 0;
}