| 8 | void pop() { S.pop(); M.pop(); } |
| 9 | bool empty() { return S.empty(); } }; |
| 10 | struct min_queue { |
| 11 | min_stack inp, outp; |
| 12 | void push(int x) { inp.push(x); } |
| 13 | void fix() { |
| 14 | if (outp.empty()) while (!inp.empty()) |
| 15 | outp.push(inp.top()), inp.pop(); } |
| 16 | int top() { fix(); return outp.top(); } |
| 17 | int mn() { |
| 18 | if (inp.empty()) return outp.mn(); |
| 19 | if (outp.empty()) return inp.mn(); |
| 20 | return min(inp.mn(), outp.mn()); } |
| 21 | void pop() { fix(); outp.pop(); } |
| 22 | bool empty() { return inp.empty() && outp.empty(); } }; |
| 23 | // vim: cc=60 ts=2 sts=2 sw=2: |
nothing calls this directly
no outgoing calls
no test coverage detected