Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <algorithm>
- #include <utility>
- #include <vector>
- using namespace std;
- struct point{double x,y;};
- vector<pair<point,int > > v;
- inline bool cmp (pair <point, int> const & a, pair <point, int> const & b) __attribute__ ((always_inline));
- inline bool cmp (pair <point, int> const & a, pair <point, int> const & b)
- {
- if (a.first.x>b.first.x)return true;
- if (a.first.x<b.first.x)return false;
- if (a.first.y>b.first.y)return true;
- return false;
- }
- int main()
- {
- for (int i = 0; i < 1000000; i++)
- {
- v.push_back (make_pair (point (), i));
- v[i].first.x = (i * 4125367) % 300000;
- v[i].first.y = i;
- }
- sort(v.begin(),v.end(),cmp);
- return 0;
- }
Add Comment
Please, Sign In to add comment