比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 小e 运行时间 10.037 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2016-10-19 21:45:09
显示代码纯文本
#include "cstdio"
#include "set"
using namespace std;

struct Node
{
	int x, y;
	inline Node(const int& a, const int& b) { x = a; y = b; }
	inline bool operator < (const Node& a) const
	{ 
		if (x == a.x) return y < a.y;
		return x < a.x; 
	}
};
set <Node> S;

inline void Read(int& a)
{
	a = 0;
	int minus = 1;
	char ch = getchar();
	if (ch == '-') minus = -1;
	while (ch < '0' || ch > '9') {
		if (ch == '-') minus = -1;
		ch = getchar();
	}
	while (ch >= '0' && ch <= '9') {
		a = a * 10 + ch - '0';
		ch = getchar();
	}
	a *= minus;
}


#define SUBMIT
int main(int argc, char const *argv[])
{
#ifdef SUBMIT
	freopen("loverfinding.in", "r", stdin); freopen("loverfinding.out", "w", stdout);
#endif

	int n, x0, y0, xt, yt, dx, dy;
	int ans = 1;
	Read(n); Read(x0); Read(y0); Read(xt); Read(yt);
	S.insert(Node(x0, y0));
	if (x0 == xt && y0 == yt) { puts("1"); goto END; }
	for (int i = 1; i <= n; ++i) {
		Read(dx); Read(dy);
		Node tmp = Node(x0+dx, y0+dy);
		if (!S.count(tmp)) { ans++; S.insert(tmp); }
		x0 += dx; y0 += dy;
		if (x0 == xt && y0 == yt) {  printf("%d\n", ans); break; }
	}
	if (!S.count(Node(xt, yt))) puts("SingleDogMZX");

END:
#ifndef SUBMIT
	printf("\n----------\n");
	system("pause");
#else
	fclose(stdin); fclose(stdout);
#endif	

	return 0;
}