比赛 |
NOIP模拟赛by mzx Day1 |
评测结果 |
EEEEEEEEEE |
题目名称 |
为爱追寻 |
最终得分 |
0 |
用户昵称 |
悟理 |
运行时间 |
1.118 s |
代码语言 |
C++ |
内存使用 |
0.28 MiB |
提交时间 |
2016-10-19 21:27:41 |
显示代码纯文本
#include <iostream>
#include <fstream>
#include <cstdio>
#include <set>
using namespace std;
#define aha 1000000000
inline long long GetInt(FILE *fin);
inline unsigned long long Pack_Coor(long long x,long long y);
FILE *fin = fopen("loverfinding.in","r"), *fout = fopen("loverfinding.out","w");
int main()
{
int DataSize = GetInt(fin);
long long px = GetInt(fin),py = GetInt(fin), dest_x = GetInt(fin), dest_y = GetInt(fin);
unsigned long long P = Pack_Coor(px,py), dest = Pack_Coor(dest_x,dest_y);
bool flag = true;
set<unsigned long long>desks;
//cout << Pack_Coor(2,3) << " " << dest << endl;
for (int i = 1;i <= DataSize;++i)
{
desks.insert(P);
px += GetInt(fin);py += GetInt(fin);
P = Pack_Coor(px,py);
//cout << (P >> 32) << " " << ((P << 32) >> 32) << " " << (dest >> 32) << " " << ((dest << 32) >> 32) << endl << endl;
if (P == dest)
flag = false;
}
fprintf(fout,"%lld\n",desks.size());
if (flag)
fprintf(fout,"SingleDogMZX\n");
return 0;
}
inline long long GetInt(FILE *fin)
{
long long num = 0;
bool flag = false;
char ch;
ch = fgetc(fin);
while (!(ch - ' ' && ch - '\n'))
ch = fgetc(fin);
if (!(ch - '-'))
{
flag = true;
ch = fgetc(fin);
}
while ('0' <= ch && ch <= '9')
{
num = (num << 3) + (num << 1) + ch - '0';
ch = fgetc(fin);
}
if (flag)
return ~num + 1;
else
return num;
}
inline unsigned long long Pack_Coor(long long x,long long y)
{
unsigned long long x1 = x,y1 = y;
if (x < 0)
x1 = -x + aha;
if (y < 0)
y1 = -y + aha;
return (x1 << 32) + y1;
}