Problem E

Statement
Copy Copied
Description:
In this problem at each moment you have a set of intervals. You can move from interval (a, b) from our set to interval (c, d) from our set if and only if c < a < d or c < b < d. Also there is a path from interval I1 from our set to interval I2 from our set if there is a sequence of successive moves starting from I1 so that we can reach I2.

Your program should handle the queries of the following two types:

1. "1 x y" (x < y) — add the new interval (x, y) to the set of intervals. The length of the new interval is guaranteed to be strictly greater than all the previous intervals.
2. "2 a b" (a ≠ b) — answer the question: is there a path from a-th (one-based) added interval to b-th (one-based) added interval?

Answer all the queries. Note, that initially you have an empty set of intervals.

Input Format:
The first line of the input contains integer n denoting the number of queries, (1 ≤ n ≤ 105). Each of the following lines contains a query as described above. All numbers in the input are integers and don't exceed 109 by their absolute value.

It's guaranteed that all queries are correct.

Output Format:
For each query of the second type print "YES" or "NO" on a separate line depending on the answer.

Note:
None

Submissions

IDLanguageExit CodeTimestampCodeStdoutStderrRetry
6138 go 0 2026-03-26T05:35:58.549047Z View View View Retry

Evaluations

Eval IDRun IDProviderModelLangSuccessTimestampPromptResponseStdoutStderrRetry
4341 20260327-230005 gemini gemini-3.1-pro-preview go false 2026-03-28T02:37:29.688498Z View View View View Retry
4007 20260325-230005 gemini gemini-3.1-pro-preview go false 2026-03-26T01:38:45.513752Z View View View View Retry