Advertisement
cincout

function at window

Nov 2nd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. struct min_window {
  2. deque <pr<int,int>> a;
  3. void add_elem(int i, int zn) {
  4. while (len(a) && a.back().second > zn) {
  5. a.pop_back();
  6. }
  7. a.push_back({ i, zn });
  8. }
  9. int get_min() {
  10. return a[0].second;
  11. }
  12. void pop_elem(int i) {
  13. if (len(a) && a[0].first == i) a.pop_front();
  14. }
  15. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement