Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
Try to split the array into some non-intersected continuous special subarrays.
For each query check that the first and the last elements of that query are in the same subarray or not.
Solve with full IDE support and test cases