=====================================================================
What are the differences between this three sort function in Mo's algo?
First: bool comp(stt q1, stt q2) { int block_a = q1.l / sq, block_b = q2.l / sq; if(block_a == block_b) return q1.r < q2.r; return block_a < block_b; }
Second: bool comp(stt q1, stt q2) { if (q1.l / sq != q2.l / sq) return q1.l< q2.l; return (q1.r < q2.r)^(q1.l/sq%2); }
Third: bool comp(stt q1, stt q2) { if(q1.l/sq != q2.l/sq) { return q1.l < q2.l; } if((q1.l/sq) & 1) { return q1.r < q2.r; } return q1.r > q2.r; }
The first approach gives the TE on test 9 Submission linkthe second approach gives the TE on test 67 Submission linkbut the third approach gives AC Submission link. Thanks in advance. v:)