比赛 NOIP模拟赛by mzx Day1 评测结果 TTTTTTTTTT
题目名称 为爱追寻 最终得分 0
用户昵称 Mealy 运行时间 10.031 s
代码语言 C++ 内存使用 0.28 MiB
提交时间 2016-10-20 17:20:20
显示代码纯文本
  1. #include <iostream>
  2. #include <cstdio>
  3. #include <map>
  4. using namespace std;
  5. class poi
  6. {
  7. public:
  8. int x,y;
  9. bool operator < (const poi p) const
  10. {
  11. return x==p.x?y<p.y:x<p.x;
  12. }
  13. };
  14. int n,sx,sy,ex,ey;
  15. int ans=1;
  16. int opx=0,opy=0;
  17. int tmpx=0,tmpy=0;
  18. map<poi ,bool > MP;
  19. void PreDo()
  20. {
  21. scanf("%d%d%d%d%d",&n,&sx,&sy,&ex,&ey);
  22. tmpx=sx,tmpy=sy;
  23. MP[(poi){sx,sy}]=1;
  24. for(int i=1;i<=n;i++)
  25. {
  26. scanf("%d%d",&opx,&opy);
  27. tmpx+=opx;
  28. tmpy+=opy;
  29. if(!MP[(poi){tmpx,tmpy}])
  30. {
  31. ans++;
  32. }
  33. MP[(poi){tmpx,tmpy}]=1;
  34. if(tmpx==ex&&tmpy==ey)
  35. {
  36. break;
  37. }
  38. }
  39. if(!MP[(poi){ex,ey}])
  40. {
  41. printf("SingleDogMZX\n");
  42. }
  43. else
  44. {
  45. printf("%d\n",ans);
  46. }
  47. }
  48. int main()
  49. {
  50. freopen("loverfinding.in","r",stdin);
  51. freopen("loverfinding.out","w",stdout);
  52. PreDo();
  53. return 0;
  54. }
  55.