Advertisement
a53

Points

a53
Dec 30th, 2019
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #include <cstdio>
  2. #include <algorithm>
  3. const int maxN=10000;
  4. const int mod=666013;
  5. int N;
  6.  
  7. class Point
  8. {
  9. public:
  10. int x, y;
  11. Point(int _x =0,int _y=0):
  12. x(_x),y(_y){}
  13. inline bool operator<(const Point& other) const
  14. {
  15. return (x ==other.x)?(y >other.y):(x<other.x);
  16. }
  17. } p[maxN+1];
  18.  
  19. int d[maxN+1];
  20.  
  21. int main()
  22. {
  23. freopen("points.in","r",stdin);
  24. freopen("points.out","w",stdout);
  25. scanf("%d",&N);
  26. for(int i=1;i<=N;++i)
  27. scanf("%d %d",&p[i].x,&p[i].y);
  28. std::sort(p+1,p+N+1);
  29. d[1]=1;
  30. for(int i=2;i<=N;++i)
  31. {
  32. d[i]=1;
  33. for(int j=i-1;j>0;--j)
  34. if(p[j].y>=p[i].y)
  35. d[i]=(d[i]+d[j])%mod;
  36. }
  37. int Ans=0;
  38. for(int i=1;i<=N;++i)
  39. Ans=(Ans+d[i])%mod;
  40. printf("%d\n",Ans);
  41. return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement