#C7330. Corridor Security
Corridor Security
Corridor Security
You are given several datasets representing sensors monitoring a long corridor. Each sensor covers a certain interval along the corridor. The corridor is considered secure if, in any dataset with at least two sensors, there exists at least one pair of sensors such that the first sensor's coverage ends at or after where the next sensor starts (i.e. their intervals overlap or touch). Otherwise, the corridor is considered not secure. Note that if there is only one sensor, the corridor is always considered not secure.
Formally, for each dataset, after sorting the sensor intervals by their starting points, if there exists an index i such that \( a_i^r \geq a_{i+1}^l \) then the corridor is secure; otherwise, it is not secure.
Input/Output requirements: Your program should read from standard input and output the result for each dataset to standard output.
inputFormat
The first line of the input contains an integer T denoting the number of datasets. The following datasets follow.
For each dataset:
- The first line contains a single integer n, representing the number of sensors.
- The next n lines each contain two space-separated integers L and R (with L ≤ R), representing the start and end points of a sensor's coverage interval.
outputFormat
For each dataset, output a single line containing either Secure
or Not Secure
depending on whether the corridor is securely monitored or not.
2
3
1 4
2 5
3 6
4
1 2
3 4
5 6
7 8
Secure
Not Secure
</p>