From b3a80bbc40fd5173128c69da71ba97558eb0f1a1 Mon Sep 17 00:00:00 2001 From: Ta180m Date: Mon, 6 Jan 2020 09:33:45 -0600 Subject: Update snowcow.cpp --- 2019/December/Platinum/snowcow.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/2019/December/Platinum/snowcow.cpp b/2019/December/Platinum/snowcow.cpp index 3c35f16..b4df8bd 100644 --- a/2019/December/Platinum/snowcow.cpp +++ b/2019/December/Platinum/snowcow.cpp @@ -101,13 +101,13 @@ int main() { int x, c; cin >> x >> c; int l = L[x], r = R[x]; - auto it = --S[c].lower_bound(ii(L[x], L[x])); + auto it = --S[c].lower_bound(ii(L[x], L[x])); // Get leftmost interval while (it != S[c].lower_bound(ii(R[x] + 1, R[x] + 1))) { - update(max(it->s + 1, L[x]), min(next(it) != S[c].end() ? next(it)->f - 1 : N, R[x]), 1); - if (it->s >= L[x] - 1) { // if intervals touch update l and r + update(max(it->s + 1, L[x]), min(next(it) != S[c].end() ? next(it)->f - 1 : N, R[x]), 1); // Update range between intervals + if (it->s >= L[x] - 1) { l = min(it->f, l); r = max(it->s, r); - it = S[c].erase(it); + it = S[c].erase(it); // Remove covered intervals } else it++; } @@ -116,7 +116,7 @@ int main() { r = max(it->s, r); S[c].erase(it); } - S[c].emplace(l, r); + S[c].emplace(l, r); // Add interval } else { int x; -- cgit v1.2.3-70-g09d2