Guest User

http://codeforces.ru/blog/entry/7162

a guest
Mar 25th, 2013
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.72 KB | None | 0 0
  1. #include <algorithm>
  2. #include <utility>
  3. #include <vector>
  4.  
  5. using namespace std;
  6.  
  7. struct point{double x,y;};
  8.  
  9. vector<pair<point,int > > v;
  10.  
  11. inline bool cmp (pair <point, int> const & a, pair <point, int> const & b) __attribute__ ((always_inline));
  12.  
  13. inline bool cmp (pair <point, int> const & a, pair <point, int> const & b)
  14. {
  15.     if (a.first.x>b.first.x)return true;
  16.     if (a.first.x<b.first.x)return false;
  17.     if (a.first.y>b.first.y)return true;
  18.     return false;
  19. }
  20.  
  21. int main()
  22. {
  23.     for (int i = 0; i < 1000000; i++)
  24.     {
  25.         v.push_back (make_pair (point (), i));
  26.         v[i].first.x = (i * 4125367) % 300000;
  27.         v[i].first.y = i;
  28.     }
  29.     sort(v.begin(),v.end(),cmp);
  30.     return 0;
  31. }
Add Comment
Please, Sign In to add comment