| 71 | cur++; |
| 72 | } |
| 73 | void push(int r, T x) { // push x at the end of the rth queue |
| 74 | st.upd(r, R[r], x); |
| 75 | L[cur] = L[r]; |
| 76 | R[cur] = R[r] + 1; |
| 77 | cur++; |
| 78 | } |
| 79 | T pop(int r) { // pops the top element of the rth queue and returns the popped element |
| 80 | st.upd(r, L[r], 0); |
| 81 | L[cur] = L[r] + 1; |