如果你的排序函数这么写:
bool cmp(P a, P b) { return a.a * a.b <= b.b * b.a; }
那么请用 stable_sort,否则会 RE on #6。
stable_sort