rand 一些题目做一下,持续更新
平衡树
gym101261A Persistent Deque
You need to process the following queries:
B v x — Add x to the beginning of the deque with version v.
E v x — Add x to the end of the deque with version v.
< v — Remove the first element of the deque with version v.
> v — Remove the last element of the deque with version v.
Assume version 0 is an empty deque. Every query creates a new version of the deque.
All queries are online, that means you should flush the output before reading the input for the following query. Use fflush(stdout) for C/C++.
\(1\le Q\le 3e5\)