比赛 NOIP模拟赛by mzx Day1 评测结果 WWWWWWWWWW
题目名称 为爱追寻 最终得分 0
用户昵称 GROWL GOOD BOYส็ 运行时间 0.279 s
代码语言 C++ 内存使用 0.22 MiB
提交时间 2016-10-19 19:50:15
显示代码纯文本
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<iostream>
  4. #include<algorithm>
  5. #include<set>
  6. #include<ctime>
  7.  
  8. using namespace std;
  9.  
  10.  
  11. int N,Ans=1;
  12.  
  13. int SX,SY,TX,TY;
  14.  
  15. struct node
  16. {
  17. int x,y;
  18. bool operator == (const node &a)const
  19. {
  20. return (a.x==x&&a.y==y);
  21. }
  22. bool operator <(const node &a)const
  23. {
  24. if(a.x!=x)return a.x<x;
  25. return a.y<y;
  26. }
  27. }ha;
  28.  
  29. set<node> p;
  30.  
  31. int main()
  32. {
  33. freopen("loverfinding.in","r",stdin);
  34. freopen("loverfinding.out","w",stdout);
  35. scanf("%d%d%d%d%d",&N,&SX,&SY,&TX,&TY);
  36. ha.x=SX,ha.y=SY;
  37. for(int x,y,i=1;i<=N;i++)
  38. {
  39. scanf("%d%d",&x,&y);
  40. SX+=x;
  41. SY+=y;
  42. //printf("i== %d %d %d\n",i,SX,SY);
  43. ha.x=SX,ha.y=SY;
  44. set<node> :: iterator it=p.lower_bound(ha);
  45. if(it!=p.end()&&*it==ha)Ans=Ans;
  46. else Ans++,p.insert(ha);
  47. if(SX==TX&&SY==TY)
  48. {
  49. printf("%d",Ans);
  50. return 0;
  51. }
  52. if(clock()>450)
  53. {
  54. printf("SingleDogMZX");
  55. return 0;
  56. }
  57. }
  58. printf("SingleDogMZX");
  59. // printf("\n time used %lf",clock()/1000.0);
  60. return 0;
  61. }