Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll sq[2][2] = { {3,2},{4,1} };
- sort(v.begin(), v.end(), [sq](auto& a, auto& b) {
- ll x1 = a.first.first;
- ll x2 = b.first.first;
- ll y1 = a.first.second;
- ll y2 = b.first.second;
- if (sq[x1 >= 0][y1 >= 0] != sq[x2 >= 0][y2 >= 0]) {
- return (sq[x1 >= 0][y1 >= 0] < sq[x2 >= 0][y2 >= 0]);
- }
- else {
- ll _mul = x1 * y2 - x2 * y1;
- if (!_mul)
- return (x1 * x1 + y1 * y1) < (x2 * x2 + y2 * y2);
- return (_mul > 0);
- }
- });
Add Comment
Please, Sign In to add comment