Problem Statement | |||||||||||||
You are given a bidirectional cyclical queue which contains N elements. You need to extract several elements from this queue.
You can do 3 kinds of operations with this queue:
| |||||||||||||
Definition | |||||||||||||
| |||||||||||||
Constraints | |||||||||||||
- | N will be between 1 and 50, inclusive. | ||||||||||||
- | indices will contain between 1 and N elements, inclusive. | ||||||||||||
- | Each element of indices will be between 1 and N, inclusive. | ||||||||||||
- | All elements of indices will be distinct. | ||||||||||||
Examples | |||||||||||||
0) | |||||||||||||
| |||||||||||||
1) | |||||||||||||
| |||||||||||||
2) | |||||||||||||
| |||||||||||||
3) | |||||||||||||
|