Non-boring Sequences
Time limit5sMemory limit128 MB
Determine whether every contiguous subarray of a sequence has at least one element unique within that subarray, using an efficient divide and conquer approach.
- Level
Medium7 of 10
- Topics
- Divide and conquer, Array, Recursion
- Solved
- No attempts yet
Problem
We were worried this statement might get too boring, so we kept it short.
A sequence is called non-boring if every one of its contiguous subsequences contains at least one unique element — an element whose value appears nowhere else in that subsequence.
Given a sequence of integers, decide whether it is non-boring.
Input
The first line contains the number of test cases . The test cases follow.
The first line of each test case contains the length of the sequence (). The next line contains the elements of the sequence, separated by single spaces. Every element is a non-negative integer less than .
Output
For each test case, print the answers in the order the test cases appear in the input. For each test case, print a single line containing either non-boring or boring.