Skip to content

Instantly share code, notes, and snippets.

@GoBigorGoHome
Last active January 5, 2020 07:54
Show Gist options
  • Save GoBigorGoHome/2c0ceee6da2792b8280b394fc6fdf73c to your computer and use it in GitHub Desktop.
Save GoBigorGoHome/2c0ceee6da2792b8280b394fc6fdf73c to your computer and use it in GitHub Desktop.
using Point = pair<int,int>;
ll cross(const Point& a, const Point& b) {
return 1ll * a.first * b.second - 1ll * a.second * b.first;
}
// 逆时针
// 参考 mnbvmar 的写法:https://codeforces.com/contest/1284/submission/68178688
bool cmp_polar(const Point& a, const Point& b) {
bool aorig = a.second > 0;
bool borig = b.second > 0;
if (aorig != borig) {
return aorig > borig;
}
return cross(a, b) > 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment