Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct min_window {
- deque <pr<int,int>> a;
- void add_elem(int i, int zn) {
- while (len(a) && a.back().second > zn) {
- a.pop_back();
- }
- a.push_back({ i, zn });
- }
- int get_min() {
- return a[0].second;
- }
- void pop_elem(int i) {
- if (len(a) && a[0].first == i) a.pop_front();
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement