Skip to content
Snippets Groups Projects
Commit b2447fba authored by Fernando K's avatar Fernando K
Browse files

Arruma algoritmo de Mo

parent 028ca0ee
Branches
No related tags found
No related merge requests found
...@@ -2,7 +2,7 @@ vector<int> mo(vector<qry> qs) { ...@@ -2,7 +2,7 @@ vector<int> mo(vector<qry> qs) {
vector<int> ans (qs.size()); vector<int> ans (qs.size());
sort(all(qs), [](qry a, qry b) { sort(all(qs), [](qry a, qry b) {
if (a.l/B != b.l/B) { return a.l < b.l; } if (a.l/B != b.l/B) { return a.l < b.l; }
return ((a.l/B) % 2 == 0) ^ (a.r < b.r); return bool(((a.l/B) % 2) ^ (a.r < b.r));
}); });
int l = 0, r = -1; int l = 0, r = -1;
for (qry q : qs) { for (qry q : qs) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment