Arthur and Brackets

题意翻译

## 题目描述 你需要构造一个长为 $2n$ 的小括号序列 $S$,左、右括号各 $n$ 个。 对于从左到右的第 $i$ 个左括号 $S_a$,需要与其配对的右括号 $S_b$ 满足 $b - a \in [L_i, R_i]$。 ## 输入格式 第一行一个正整数 $n ~ (1 \leq n \leq 600)$。 接下来的 $n$ 行,每行两个正整数 $L_i, R_i ~ (1 \leq L_i, R_i \leq 2n)$。 ## 输出格式 如果可以构造 $S$,输出任意一种方案。 如果无法构造,输出 `IMPOSSIBLE`。

题目描述

Notice that the memory limit is non-standard. Recently Arthur and Sasha have studied correct bracket sequences. Arthur understood this topic perfectly and become so amazed about correct bracket sequences, so he even got himself a favorite correct bracket sequence of length $ 2n $ . Unlike Arthur, Sasha understood the topic very badly, and broke Arthur's favorite correct bracket sequence just to spite him. All Arthur remembers about his favorite sequence is for each opening parenthesis ('(') the approximate distance to the corresponding closing one (')'). For the $ i $ -th opening bracket he remembers the segment $ [l_{i},r_{i}] $ , containing the distance to the corresponding closing bracket. Formally speaking, for the $ i $ -th opening bracket (in order from left to right) we know that the difference of its position and the position of the corresponding closing bracket belongs to the segment $ [l_{i},r_{i}] $ . Help Arthur restore his favorite correct bracket sequence!

输入输出格式

输入格式


The first line contains integer $ n $ ( $ 1<=n<=600 $ ), the number of opening brackets in Arthur's favorite correct bracket sequence. Next $ n $ lines contain numbers $ l_{i} $ and $ r_{i} $ ( $ 1<=l_{i}<=r_{i}&lt;2n $ ), representing the segment where lies the distance from the $ i $ -th opening bracket and the corresponding closing one. The descriptions of the segments are given in the order in which the opening brackets occur in Arthur's favorite sequence if we list them from left to right.

输出格式


If it is possible to restore the correct bracket sequence by the given data, print any possible choice. If Arthur got something wrong, and there are no sequences corresponding to the given information, print a single line "IMPOSSIBLE" (without the quotes).

输入输出样例

输入样例 #1

4
1 1
1 1
1 1
1 1

输出样例 #1

()()()()

输入样例 #2

3
5 5
3 3
1 1

输出样例 #2

((()))

输入样例 #3

3
5 5
3 3
2 2

输出样例 #3

IMPOSSIBLE

输入样例 #4

3
2 3
1 4
1 4

输出样例 #4

(())()