Skip to content

Commit ff9dba7

Browse files
committed
golf
1 parent bbe6da2 commit ff9dba7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

library/data_structures_[l,r)/uncommon/priority_queue_of_updates.hpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ template<class F, class G> struct pq_updates {
3030
int j = sz(st), t = j - 1;
3131
for (auto it = rbegin(mp);
3232
2 * (sz(st) - j) < sz(st) - t; it++) {
33-
t = min(t, it->second);
34-
if (--j != it->second) {
35-
swap(st[j], st[it->second]);
36-
swap(it->second, st[it->second].first->second);
37-
}
33+
int k = it->second;
34+
t = min(t, k);
35+
auto a = st[--j], b = st[k];
36+
st[j] = b, st[j].first->second = j;
37+
st[k] = a, st[k].first->second = k;
3838
}
3939
rep(i, t, sz(st)) undo();
4040
mp.erase(st.back().first);

0 commit comments

Comments
 (0)