带修莫队如何奇偶排序?

学术版

```cpp struct tp{ int x, y, t, i; bool operator < (const tp &b) const{ return x/L != b.x/L ? x < b.x : y/L != b.y/L ? (y<b.y) ^ ((x/L)%2) : t<b.t; } } a[M]; ```
by Missa @ 2022-05-14 18:46:17


@[Missa](/user/443664) 所以t那一维奇偶排序是否可行?那样优化是否有效?
by Xeqwq @ 2022-05-14 18:51:28


@[整活队长xeq](/user/229373) ```cpp bool cmp(const Ask&a,const Ask&b){ return (getb(a.l) != getb(b.l))?(a.l<b.l):((getb(a.r) != getb(b.r))?((getb(a.l)&1)?(a.r<b.r):(a.r>b.r)):((getb(a.r)&1)?(a.t>b.t):(a.t<b.t))); } //getb(p) 表示 p 所在块的编号 ```
by hjxhjx @ 2022-05-14 19:17:07


压了点行 抱歉
by hjxhjx @ 2022-05-14 19:17:34


@[hjxhjx](/user/178480) thx
by Xeqwq @ 2022-05-14 20:34:28


|