diff options
author | Ta180m | 2020-01-06 09:33:45 -0600 |
---|---|---|
committer | GitHub | 2020-01-06 09:33:45 -0600 |
commit | b3a80bbc40fd5173128c69da71ba97558eb0f1a1 (patch) | |
tree | 530339f5b8c26ae921f7d90a85570e5546df4099 | |
parent | 73cfc387954926a64f4f16ba564777fc40c2ab10 (diff) |
Update snowcow.cpp
-rw-r--r-- | 2019/December/Platinum/snowcow.cpp | 10 |
1 files 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; |