Nested Ranges Check
#2168Ask AI
Open a hint-first prompt in a new AI chat. Grok may ask you to confirm before sending.
Open Claude DesktopGiven ranges, your task is to determine for each range if it contains some other range and if some other range contains it.
Range contains range if and .
Input
The first input line has an integer : the number of ranges.
After this, there are lines that describe the ranges. Each line has two integers and : the range is .
You may assume that no range appears more than once in the input.
Output
First print a line that describes for each range (in the input order) if it contains some other range (1) or not (0).
Then print a line that describes for each range (in the input order) if some other range contains it (1) or not (0).
4 1 6 2 4 4 8 3 6
1 0 0 0 0 1 0 1
Tools
4 1 6 2 4 4 8 3 6
1 0 0 0 0 1 0 1