比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 sxysxy 运行时间 10.014 s
代码语言 C++ 内存使用 0.30 MiB
提交时间 2016-10-19 18:51:01
显示代码纯文本
#include <cstdio>
#include <cstdlib>
#include <cstdarg>
#include <algorithm>
#include <list>
#include <queue>
#include <ext/pb_ds/hash_policy.hpp>
#include <ext/pb_ds/assoc_container.hpp>
#include <vector>
#include <cctype>
using namespace std;
using namespace __gnu_pbds;
typedef long long LL;
cc_hash_table<LL, bool> hh;
LL makehh(int x, int y)
{
    long long r = x;
    r <<= 32;
    r += y;
    return r;
}
int main()
{
    freopen("loverfinding.in", "r", stdin);
    freopen("loverfinding.out", "w", stdout);
    int n, x0, y0, xt, yt;
    scanf("%d %d %d %d %d", &n, &x0, &y0, &xt, &yt);
    bool flag = false;
    int zz = 1;
    hh[makehh(x0, y0)] = true;
    if(x0 == xt && y0 == yt)
    {
        printf("%d\n", 1);
        return 0;
    }
    while(n--)
    {
        int dx, dy;
        scanf("%d %d", &dx, &dy);
        x0 += dx;
        y0 += dy;
        LL h = makehh(x0, y0);
        if(!hh[h])
        {
            zz += 1;
            hh[h] = true;
        }
        if(x0 == xt && y0 == yt)
        {
            flag = true;
            break;
        }
    }
    if(flag)printf("%d\n", zz);
    else puts("SingleDogMZX");
    return 0;
}