QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#63824#5108. Prehistoric ProgramsQingyuAC ✓452ms109052kbC++231.1kb2022-11-23 14:15:372022-11-23 14:24:53

Judging History

你现在查看的是最新测评结果

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-23 14:24:53]
  • 评测
  • 测评结果:AC
  • 用时:452ms
  • 内存:109052kb
  • [2022-11-23 14:15:37]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N = 2e6 + 5;

int n, lf, rt;
string str[N], aux;
vector<pair<int, int>> pos, neg;
vector<int> ans;

void solve(int i){
	int tot = 0, mn = 0, l = 0, r = 0;
	for(auto x : str[i]) {
		if (x == '(') {
			++tot;
			++r;
		}
		else {
			--tot;
			if (r) {
				--r;
			}
			else {
				++l;
			}
		}
	}
	if(tot >= 0) pos.push_back({l, i});
	else neg.push_back({-r, i});
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	cout.tie(nullptr);
	cin >> n;
	for(int i = 1; i <= n; i++) {
		cin >> str[i]; 
		solve(i);
	}
	sort(pos.begin(), pos.end()); 
	sort(neg.begin(), neg.end());
	for (auto x : pos) {
		ans.push_back(x.second); 
		aux += str[x.second];
	}
	for (auto x : neg) {
		ans.push_back(x.second); 
		aux += str[x.second];
	}
	for (auto x : aux) {
		if (x == '(') {
			++rt;
		}
		else if (rt) {
			--rt;
		}
		else {
			++lf;
		}
	}

	if(lf || rt) {
		cout << "impossible" << '\n';
	}
	else {
		for(auto x : ans) cout << x << '\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 32ms
memory: 67876kb

input:

50000
(
(
))))()))()(()))()()()))()(((((()(((()))()(((()))((()(())))))(()(
)
(
)
(((
(
(
(
(
(
()
(
)
(
)((())()((
)))))(
(
)
))
)()
(
)
)
)()(
(
(
()
(
)
(
)()((((())()))())(
(
(
)(
(
(
(()())())
)
)
(
(
(
)((())))((())))))))))((((()()))()))))))))((()())()))
)
)()
)
)
)
)
)
())(())))))()(()((()(())...

output:

1
2
5
7
8
9
10
11
12
13
14
16
19
23
27
28
29
30
32
34
35
37
38
42
43
44
54
55
58
59
61
65
69
70
72
76
77
79
80
87
91
92
93
94
95
96
97
99
103
112
116
117
118
120
122
125
126
127
128
129
130
131
133
135
136
143
146
147
148
149
150
151
154
161
162
163
164
165
166
169
172
175
176
177
178
179
181
182
18...

result:

ok good plan

Test #2:

score: 0
Accepted
time: 16ms
memory: 66068kb

input:

1000
(
))(()))
((((())())))((())(()))(
)(
)
)))
))((()(((((((())()(())()())))(()(())()())))))))((()((()())()())(())))()((()())
)((()()()(())(()))()(())()))(()))))())))))))))))))()))(()()(())(()))())()()))))(())()()()((())(()))(())))))))(()()())()))()())))()()))))))(
)))(((
(
)))()()())))
(
(((())(((...

output:

1
3
10
12
13
14
17
18
20
22
30
31
33
35
36
39
45
54
58
60
62
64
65
66
75
77
80
83
84
85
88
89
90
92
97
98
101
104
106
110
112
115
122
123
125
126
127
128
131
134
135
136
143
147
162
164
166
168
171
177
178
179
181
182
188
189
190
197
198
206
208
209
212
213
214
215
216
217
221
223
228
229
239
242
24...

result:

ok good plan

Test #3:

score: 0
Accepted
time: 20ms
memory: 65792kb

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

score: 0
Accepted
time: 4ms
memory: 65928kb

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

score: 0
Accepted
time: 17ms
memory: 65880kb

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

score: 0
Accepted
time: 11ms
memory: 65856kb

input:

3
()
(
)

output:

1
2
3

result:

ok good plan

Test #7:

score: 0
Accepted
time: 24ms
memory: 65728kb

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

score: 0
Accepted
time: 7ms
memory: 65804kb

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

score: 0
Accepted
time: 8ms
memory: 65932kb

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

score: 0
Accepted
time: 7ms
memory: 65768kb

input:

6
)
()
()()()
((
)
)

output:

impossible

result:

ok impossible

Test #11:

score: 0
Accepted
time: 3ms
memory: 65964kb

input:

500
(
)
)
(
)(
(
(
)
))(
(
(
(
(
)
)
(
(
)
(
(
)
(
()(()
(
)())
(
(
)
(
)()((
(
)
(
)
)
(
(
(
)
(
(
)
)
)(
(
(
)
)
(
)
(
(
(
)
(
(
())))
(
(
(
)
(
)
)
(
(
)
)
(
(
(
(
(
()
(
(
(
(
(
((
)
(
(
)
(
(
(
)
())
(
(
(
)
(
(
(
)
)
(
)
)
(
)
(
(
(
(
)
(
)
)
)
)
(
)
)))()(
(
)
)
(
)
)(
)
(
)
)
))
(
(
(
(
(
(
...

output:

1
4
6
7
10
11
12
13
16
17
19
20
22
23
24
26
27
29
31
33
36
37
38
40
41
45
46
49
51
52
53
55
56
58
59
60
62
65
66
69
70
71
72
73
74
75
76
77
78
79
80
82
83
85
86
87
90
91
92
94
95
96
99
102
104
105
106
107
109
114
117
120
124
128
129
130
131
132
133
136
139
141
143
149
152
153
156
157
158
159
160
166...

result:

ok good plan

Test #12:

score: 0
Accepted
time: 7ms
memory: 65936kb

input:

50
)
)
((((()())())))(())(())
()(((()))
(((()))(()
()(((
))
)
)()))(()(()())(((((()
(
)
)
)((
)()((
())()))
(())))()
(((
))))(()
()(())(()))())()
)
)
(
(
(
(
((())()())())))(((())
()(
(()(())()((()
()(((()())))())()(
)
)((()
(
)
((
)
()(
(
(
)
)))((())
)
()))()(((()(()
((
((()))(())(()())(()())())()...

output:

3
4
5
6
10
17
22
23
24
25
27
28
32
34
36
37
38
43
13
14
29
31
46
42
9
26
45
18
40
44
47
50
1
2
7
8
11
12
15
16
19
20
21
30
33
35
39
41
48
49

result:

ok good plan

Test #13:

score: 0
Accepted
time: 24ms
memory: 65968kb

input:

50
)
(
)()(
())(
()()(((((())(
)(())(()((())(()(()))(())())))))(())()))()())))))()(()()))(())))(()(((())(())()((())())()())(())())))()((()(()(())((()()))))()((((())()())((()))))((()()(())))))(()(())(()(()((())(()(())((()())))())(()))()())))()()((((()()((()()))((())())))()(())((()()((()((())())(()(()...

output:

2
5
8
11
13
15
16
18
26
28
33
40
41
46
47
3
4
10
19
37
42
44
29
21
6
31
23
12
1
7
9
14
17
20
22
24
25
27
30
32
34
35
36
38
39
43
45
48
49
50

result:

ok good plan

Test #14:

score: 0
Accepted
time: 16ms
memory: 65940kb

input:

150
))(()))(())(())))()))())()()()(())(((())))()))))()
)))()(()()(()((())())))(()(()(())((())))(((()(((())()()())))()())(((((((()))((())((())(())())(()))()(()()()()((((()))(()())))()(()((()(()(((((()((()())()))((((()))()))(()(((()()(((()(((()(((())(())())(()((()))))))()())((()(())())))((()()(()(((()...

output:

4
6
7
11
12
14
15
17
20
24
28
32
35
37
38
40
48
49
52
53
60
69
73
79
84
87
92
94
98
100
103
104
105
106
111
120
130
136
140
141
142
143
148
149
5
10
16
23
27
51
61
62
70
89
91
93
96
117
129
133
135
137
29
77
102
147
2
3
9
25
122
125
18
41
43
47
56
86
115
134
150
59
30
45
85
19
55
21
33
8
121
126
71
...

result:

ok good plan

Test #15:

score: 0
Accepted
time: 8ms
memory: 65908kb

input:

150
)))(
(()
(())((())))(()))()(()
((((()(((()))()(((((())()(()()((((()))((((()(())()(()))(()(())())(())(())))(((()))(())()))()((())((()(()(())())))))()(((()(()()())()))))()))(()(()()()(()(())()))))()))(((((())(()())((()()((((()))))(())())(())(())((()()(())))((((())((((()))()))()))))))))()())))))
(
...

output:

2
4
5
8
10
14
15
19
26
32
36
37
42
44
46
49
51
52
56
58
61
64
66
70
86
87
89
94
98
100
104
118
121
127
128
129
141
142
148
149
150
16
18
23
29
50
55
75
80
84
102
107
112
113
117
145
34
39
53
63
74
76
82
114
136
88
90
85
144
21
13
140
7
41
62
45
40
111
96
97
79
81
116
139
20
78
108
125
130
137
1
3
27...

result:

ok good plan

Test #16:

score: 0
Accepted
time: 8ms
memory: 66008kb

input:

150
)()((
)
)))())))
)()())((()(()())((())()))(()))(())((((((((()()(())())(()(((()))())()((()((())())))))))()((()))))((()(((()(((((()))()))((()((()()))(())))))()))))()())()()())(())(())(()))())((((((()()()))()((((()))))))((())()))()(()((()(())(())(())()())(())
()()
)
(())()))(())(()((())()()())())((...

output:

5
8
27
30
36
45
48
50
52
55
58
60
65
67
68
74
75
81
84
89
92
93
97
98
99
106
108
110
111
115
117
118
122
123
129
130
131
136
140
149
1
9
11
19
24
26
31
42
46
56
57
63
70
88
100
124
127
14
15
35
82
91
101
114
119
120
128
146
37
107
133
32
43
12
78
90
44
61
112
7
64
109
125
85
72
144
41
22
20
28
95
16...

result:

ok good plan

Test #17:

score: 0
Accepted
time: 26ms
memory: 66020kb

input:

750
(()()((()((((())()((()))()()))()))(()()(()))(()(())()))((((((
)))))))
)
((()()()(())((()(()())(())(((()((((()))(()(())((())(()())(())())))())))()(())()))((()(()((((()(()))(()())()((()()()))))(())())(())())())()((()(
)
)
(
)()(((()(())))()))))(((((((()))()()()(()())))(()())(()((
(
)
)(()))
((())(...

output:

1
4
7
9
13
16
17
19
20
21
22
25
27
34
37
41
43
45
48
55
56
57
58
62
65
66
67
69
74
79
80
81
82
95
97
101
103
104
105
108
112
116
121
122
131
136
138
141
148
149
150
152
155
156
157
158
159
160
162
163
164
166
169
172
175
176
180
181
182
184
185
186
191
195
197
204
208
212
213
214
218
220
224
225
227...

result:

ok good plan

Test #18:

score: 0
Accepted
time: 19ms
memory: 65784kb

input:

100
)
)
)
(
)
(
))))()
)
(
(
(
(
)
)
)
)
(
(
(
(
())
(
)
)
)((
)
(
(
(
)
(
(
)
)
)
)
()((
(
)
)
)
)(((
((((
(
)
(
)
((
)
(
(
)
(
())(()))
)
)
(
)
(
(
(
(
)))()()
)
(
(
(
(
)
(
)
)
)
(
)
)
)
)
(
)
(
(
)
(
)
(
(
(
)
)
(
)
)
(
)((((
)
)
()((()()(()))))
)
(

output:

4
6
9
10
11
12
17
18
19
20
22
27
28
29
31
32
37
38
43
44
46
48
50
51
53
57
59
60
61
62
65
66
67
68
70
74
79
81
82
84
86
87
88
91
94
100
25
42
95
1
2
3
5
7
8
13
14
15
16
21
23
24
26
30
33
34
35
36
39
40
41
45
47
49
52
54
55
56
58
63
64
69
71
72
73
75
76
77
78
80
83
85
89
90
92
93
96
97
98
99

result:

ok good plan

Test #19:

score: 0
Accepted
time: 11ms
memory: 65832kb

input:

100
)
()(
(
)
(
)
(
(
)
)
)(()
)
)))
)
)
(
(
(
)
(
(
)
(
)
(
(
(
))(
(
(
))((
(
)
(
))())
)
(()
)
)
(
)
(
(
)
)
(
)
(
))
(
(
)
)
(
)
)
)
)
(
())
)
(
(
)
)
(
)
(
))
(
)
)
(
(
(((
(
(
(()
)
)()())(()((()((())
(
)
)
(
(
)
)
(
)
(
)
(
))(
)
(
(
(
)
(
(((())

output:

impossible

result:

ok impossible

Test #20:

score: 0
Accepted
time: 23ms
memory: 65784kb

input:

100
)
)
()))((((
))()
(
(
(
)
(
)
(
(
)
()
(
(
)
)
(
)
(
(
)
)
)
(
)
)
(
(
)
)
(
)
)
)
)
(
(
)
((
(
(
)
)
(
(
)
(
)
(()((
)
(
)
)
(()))()()())))()()((
(
)
)
(
(
(
)
)
(
(
)
(
(
(
)
(
(
)
)(
(
)
)
)
(
(())())(()
)
)
(
()
((
(
)
)
)
)
(
)
(
(
)
)
(
())
)(

output:

5
6
7
9
11
12
14
15
16
19
21
22
26
29
30
33
38
39
41
42
43
46
47
49
51
53
57
60
61
62
65
66
68
69
70
72
73
76
80
84
85
86
87
92
94
95
98
75
81
100
3
56
1
2
4
8
10
13
17
18
20
23
24
25
27
28
31
32
34
35
36
37
40
44
45
48
50
52
54
55
58
59
63
64
67
71
74
77
78
79
82
83
88
89
90
91
93
96
97
99

result:

ok good plan

Test #21:

score: 0
Accepted
time: 8ms
memory: 65864kb

input:

100
(
(
)
(
)
(
(
(
(
)
)
)
)
()
)(
)
)
(
(
)
(
(
)
)
)
(
)
(
(
))))
(
)
(
)
(
(
(
()()(
)
())
(
(
)
)
(
(
)
(
(
)
)
(
(
(
(
(
)
(
(
(((
)
)
)
))))
(
))(
)
)
()
())()
)
)
(
)))
(
)((()))(
(
(((
((
(
)
(
(
)
(
)
)
()
)()
)
)
()))()(
)(())(
)
(
(
(
(
)(
)

output:

1
2
4
6
7
8
9
14
18
19
21
22
26
28
29
31
33
35
36
37
38
41
42
45
46
48
49
52
53
54
55
56
58
59
60
65
69
73
75
77
78
79
80
82
83
85
88
95
96
97
98
15
76
93
99
66
92
3
5
10
11
12
13
16
17
20
23
24
25
27
30
32
34
39
40
43
44
47
50
51
57
61
62
63
64
67
68
70
71
72
74
81
84
86
87
89
90
91
94
100

result:

ok good plan

Test #22:

score: 0
Accepted
time: 12ms
memory: 65920kb

input:

1000
(())())()(((())()())(((()(()))((()((((()())))())))))(()(()((())(((()))()(()
)
(
)
()
)
)((()))))
)
((((((()))()())))))((()(
((
()(()())))(()
)()
(
((
(
)
)
)(()
)))(
)
))
(
(()))))
)(())(((())((((
)
)
(
(
())))(())
(((
(
(((
())()(
()())
)
)
)
(
))))())(
)
))(
)
())(()(()))))()(()((())((((()())...

output:

impossible

result:

ok impossible

Test #23:

score: 0
Accepted
time: 14ms
memory: 66008kb

input:

1000
))(()))
(
)))(
)
((
()))()))))()()(
))))((((((((()()(())((()()
(
)
)()(()
(
()))))()
(
(()(()(((()())(((((((())()()())())(())()))))((()((())((((((()(()()
)(()())((()))
(((
)
)
(
)((
(
(
)
(
)
()(())(((
(
)
(
(
)
()(()(()()(()()((()))())((()())))))((())(((()()(())(()()())(()()(((())()(()((((((((...

output:

impossible

result:

ok impossible

Test #24:

score: 0
Accepted
time: 8ms
memory: 65956kb

input:

4000
(
)
))
)()))))(
(
)
(
)
)
)
)((()((
(
)
)()(
)
)
)
)
(
)
(
)
)
(
()))((()))))()((()(
(
)))
(
)
(
(
(
(
)
)()(()()(()()))))())
)
)
)(((
)
)
)
)
(
(
)
))()()))((())
(
(
)
(
))(
(
)
)
(
)
)
())(
)
(
(
(
)
())))(())((()(()()((()((
(
)
)
(
)
)
)
)
)
)
)
)
(
)
(()))))(
)
)
(
())))(((())()(
(
(
()(
(
...

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 265ms
memory: 99388kb

input:

1000000
)
(
)()(((()))(
(
(
(
)
(
(
)
)
(((())((()(()((())
(
)
)(
)
)
))))(()))()())(()((()))(()()()))()()()))))))))(())))((((()(()()))((((((()((((()()(
)
((
)
)
(
)
())()()((
)
)))(())((()))((()()))(()(())())))())))())))(()()(
(
()(
(
(
()()
)
))
)
(
(
(
)
)
)
(
)
(
)
)
)
)(()))()))
(
)
)))
(
)
(
(...

output:

2
4
5
6
8
9
12
13
20
23
28
29
30
31
32
36
37
38
42
44
49
52
54
55
60
63
65
66
69
74
77
82
86
87
88
89
90
91
94
95
98
99
100
102
104
106
110
111
112
117
119
120
122
133
135
139
140
142
143
144
147
149
150
151
153
156
157
159
164
165
167
168
170
172
177
179
180
181
183
190
192
193
197
200
203
204
207
...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 41ms
memory: 85344kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 40ms
memory: 85160kb

input:

1
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...

output:

impossible

result:

ok impossible

Test #28:

score: 0
Accepted
time: 44ms
memory: 84960kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 64ms
memory: 85352kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 51ms
memory: 85096kb

input:

1
((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((...

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 50ms
memory: 91432kb

input:

2
))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))...

output:

2
1

result:

ok good plan

Test #32:

score: 0
Accepted
time: 35ms
memory: 91496kb

input:

2
)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 48ms
memory: 94792kb

input:

3
)()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(...

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 118ms
memory: 98500kb

input:

1000000
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((((((
((((((...

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 116ms
memory: 98372kb

input:

1000000
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))))))
))))))...

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 179ms
memory: 95784kb

input:

1000000
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))))))
((((((((((
))))))...

output:

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
172
174
176
1...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 182ms
memory: 106652kb

input:

999999
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)...

output:

500001
500002
500003
500004
500005
500006
500007
500008
500009
500010
500011
500012
500013
500014
500015
500016
500017
500018
500019
500020
500021
500022
500023
500024
500025
500026
500027
500028
500029
500030
500031
500032
500033
500034
500035
500036
500037
500038
500039
500040
500041
500042
500043...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 452ms
memory: 107836kb

input:

1000000
)(
()(()))()((
)())
)()((((((
((((
))))))))()())((()(
)((
)())
))()((()
()
(
)(
()(
(((()((()())(()))(((())(((
)()()
)))(
(((
(()(()(())))(())))(((((
())())((()))(
(())
(()
()))(()(())()())(
())((
)))))))))
())()((())))(
()())((((()())()
((
()())
()((())
)()))))))))()())()))())
()())
)()())
...

output:

5
10
11
13
14
17
20
21
27
29
33
36
37
40
43
49
57
59
61
62
63
65
75
83
84
87
90
93
99
102
104
115
119
128
133
139
146
151
154
155
157
158
159
164
173
174
176
181
183
185
187
190
191
194
196
197
207
212
214
215
218
219
222
223
224
226
229
230
233
237
239
240
243
244
249
250
251
252
253
257
258
260
26...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 387ms
memory: 109052kb

input:

1000000
)()))))(()(((()
()((((()))
)())
)
()()(
()
())()((())))))())()(())(())
())))()())((
)()()((()((())
)
)()(
()()(
((())((
)(
(
)((()((()((()(())(()())
))()
())
()()()
(())
))()(()(()()()()((
(())))()((((()()(
(())
)())((()))
))(()
()()()(()(()()((((())))((())))(()()(()))))
(()()))()(())))()))(...

output:

2
5
6
12
13
15
19
20
23
26
29
36
38
39
44
46
47
59
61
66
70
72
75
86
87
92
94
97
99
100
101
104
110
113
115
118
119
126
128
132
134
136
138
141
143
149
150
157
158
163
168
171
180
187
189
190
193
195
211
219
225
228
230
232
233
235
237
239
243
247
253
257
258
259
260
269
270
273
274
278
279
282
284
...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 141ms
memory: 88448kb

input:

564
)())((())((()))))(()())((((()()(()(()))(()((((()()))(((()))(()()()(()((()()()()((()))))((())))()(()((())(()())))))))())))(((())()()()))))()((((()()))()(()()())))(()()(())((())((()())(()()())()(((()))()())())))(((()(((((()())()())))()()((())))()()()(()()))()(()()()(((())())))(()(()(()((())()((()(...

output:

105
108
163
236
253
287
305
358
360
367
469
537
542
93
307
17
65
95
243
267
329
359
528
541
563
75
100
134
356
445
465
513
26
44
113
302
514
54
265
281
342
405
531
547
555
133
139
153
286
340
11
52
301
350
421
451
24
32
255
299
408
463
483
81
235
330
529
533
553
43
137
223
327
373
443
510
552
40
49
...

result:

ok good plan

Test #41:

score: 0
Accepted
time: 132ms
memory: 85828kb

input:

109
)(()((())()(())())))))((()(((()((()()())))()))()()()()))(()(()()((()()())())()))())(((()()))(()))))(()((()((()()(((()))()((((()(()()()(()))))))))())((())(())()((()))))((())()()())))))(())))())()())))())()(()))))(())()(((()((((()))))((()())()())())))())((()(()())()())((((()()(()((()))(())((()((()...

output:

12
48
75
7
81
33
36
76
16
99
10
105
59
70
108
22
5
15
69
87
9
55
84
3
66
80
39
78
8
46
21
95
96
53
51
6
62
64
13
23
97
27
52
65
28
68
2
88
31
1
34
19
25
32
4
77
100
30
11
86
20
14
50
35
73
67
47
58
56
94
26
103
91
17
54
101
107
109
93
63
82
24
92
57
98
60
40
79
41
71
102
106
37
74
18
104
49
42
38
83...

result:

ok good plan

Test #42:

score: 0
Accepted
time: 133ms
memory: 86940kb

input:

64026
)()()()))((())((()(())())(()()())))(())))()))()(((())())))()))(()(()())((())((()(()))))()))())()(()(()))))())))(()()()()(((((()()()))))))((((()(()(())()))((()))))()())())(()(((()))))()))())))(()()()(())))((((())(())())(()()))()))))(())))()(((())()()()())()))))(())()(()(((())(()()()()((()()((()...

output:

51
58
59
60
69
112
120
144
146
159
163
186
193
195
198
202
204
209
210
228
231
232
242
258
263
264
269
271
282
285
288
297
301
302
309
314
351
352
370
377
378
391
394
397
398
404
409
410
414
415
424
442
446
455
481
501
508
510
518
530
549
563
566
575
584
586
595
602
612
614
622
625
631
635
654
657
6...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 338ms
memory: 104272kb

input:

741507
)))((())))))()))(()()())((()((
))())
()
)(((()))()((()()(()())(())(((
(()))())()))))((
))(
)()
((()((()()()))(
(()(
(()())())(
)
)
(((()()(()(
()()(((
)(())))((((()((()()))))(()())(()))())((()((()((((()))()()(
()))
())())())))(()))(
())))()(
)(
(())()()())()())()((()))(
(())
)))()()
)
)(())()...

output:

3
8
9
13
14
21
29
41
42
46
48
53
57
61
65
66
69
84
89
107
108
109
110
115
117
118
121
125
131
133
135
143
144
145
156
157
164
167
170
171
177
180
181
184
188
189
192
193
204
206
207
208
212
219
220
225
227
232
233
235
236
237
240
244
250
252
253
257
261
264
265
266
267
272
273
274
277
282
295
298
30...

result:

ok good plan

Test #44:

score: 0
Accepted
time: 19ms
memory: 65904kb

input:

32
())((())(()(((())())()())((())(()(((((((()))()(())))))())(())))((())((((()))(()(()(()(()))()(())())((()())(()((((((()(()(()()(()))()(())(()(()()))()())))()((()()(()(())))((()(()(()))))())()()(())(())(())()))(((()((((()())(()()()()()())()())())((()(()(()()
()
()))()()()(()())()((())))()((()()(()()...

output:

2
7
17
23
25
1
21
11
22
32
3
6
10
24
27
8
15
14
29
31
26
9
19
20
4
30
16
18
5
12
13
28

result:

ok good plan

Test #45:

score: 0
Accepted
time: 20ms
memory: 65796kb

input:

8
())(()()))))()(()))))()()(()()(())))((())))))(((())))))())((((()))((()))((())))()()))()(())(()(()()()(()())()(()((())()))(((((()(((()((()()((()()(())(()())()((()))))())()())(()))())(((((((()())(())))(()))))(())(())(()))))))(()(((()((()((((()))(()(((()))()))()())(((()))(((())(())))))(((())()()()))(...

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

score: 0
Accepted
time: 19ms
memory: 65812kb

input:

32
()))()(()))()()()()()(())((()()(()))(()
(()())())()))()(())())))()(()())()((()(()(()))()(()((((((((()))()))))((((())()))()((((()))((())()(()(()((()()()))))()()())()()((()(()()(((()))()))((()(()()(((()((())((((((((()())()(((()(()))(
)))()()()((())()()
())))((()))(()(((()((()()()))(()
)((()))))()))...

output:

23
10
13
14
27
29
8
21
31
4
17
28
2
6
32
20
26
7
19
15
1
22
24
3
11
18
5
9
12
16
25
30

result:

ok good plan

Test #47:

score: 0
Accepted
time: 11ms
memory: 65868kb

input:

53
))(((((())))))))((()()())()))())())())())(())())(())())(((()((()())(()(())))())(((
()()))((())))()))()(())))()))()(()(())))((())((((((()))()(()))))))))((()))))))))((())()))(()))())()()(()))()())()())())()(())(((()(
)())
()))))()))()(()()))()))(()((((()))(()))())(((()))(()()()))(())))(())))()(((((...

output:

7
14
17
18
19
24
25
27
29
30
36
38
40
44
52
12
13
5
22
32
41
37
42
47
11
15
4
21
26
31
1
33
49
2
50
16
10
28
39
43
45
46
53
6
8
23
51
3
9
20
34
35
48

result:

ok good plan

Test #48:

score: 0
Accepted
time: 11ms
memory: 65844kb

input:

25
)()((()())()))())))(((())))(())(()))))(()(()))((()()())(()((()())))(())())())())((()((()()(())))))))()((())())(()()(()()()())()())(()((()())(((())))()))(())()()()()((()))()(((())(())())((()((()))))(()(((()(())()()(((()))(()())(()))((())()))()))())(((()))))()()()((())((())()))()(())()(((((()())(((...

output:

5
11
21
25
9
12
14
19
20
7
13
22
1
15
4
16
8
6
24
17
23
10
2
3
18

result:

ok good plan

Test #49:

score: 0
Accepted
time: 14ms
memory: 65972kb

input:

90
))))((()()()))())))(
()())((((())))()))((())()()))))())(()()()(()))())))))((())())))()))(()())((())()(())))((((()(()()()())))()()))()(()())))())(((
))))())))()))))()((()(())(()((())(())()(()())))))()((()))((()()(()())()((()())((()()(()()(())())())()()(()))((()((()()(()()(()((()()()()))(())))))())...

output:

6
15
21
23
24
33
36
43
44
45
50
62
79
83
4
18
19
34
42
56
60
63
77
84
90
12
27
30
31
39
52
53
59
61
70
78
37
40
54
9
86
87
22
76
7
14
57
74
49
8
16
75
81
80
35
51
73
69
89
2
3
66
72
88
5
20
28
46
65
1
11
13
41
47
48
55
10
17
25
26
29
32
38
58
64
67
68
71
82
85

result:

ok good plan

Test #50:

score: 0
Accepted
time: 8ms
memory: 65748kb

input:

16
))))))(((()(())()()(()((()()((())(()()(())))((())))))))(())(()))()((())((()(()()))())((())))()()()((()()))(((()()))()()))))()())))()))(((((()))(()()((()(()()()((((((()()(((((()(())))())()(())()())()(()(())()))()()()))(()(()))(())))(()))(((())))((((((()))(()((((())()())()(())()))()))(())()))))())(...

output:

3
5
11
14
6
10
12
9
1
16
2
7
13
15
8
4

result:

ok good plan

Test #51:

score: 0
Accepted
time: 24ms
memory: 65844kb

input:

28
(())((()(()
(()))())()()()()(())()()(()
(()()))()))()))()((()()()()))()((()))))))())))(()))))(())())()()(()(((((((()((())))(()))(())))())(((())))))))))))))))))))))))))))))))))))))))))))))))
)())())((((()((()()(()(()
)(()()((()((())((()()))())
(((()((((()())((((()())(())))())(()))))))((())()))))()...

output:

1
11
17
18
23
27
28
5
9
26
4
16
25
10
14
13
19
12
20
6
15
22
24
2
7
3
8
21

result:

ok good plan

Test #52:

score: 0
Accepted
time: 12ms
memory: 65800kb

input:

14
))(())()((((()((()((()(()))))())))((()()((())(((()))(())))((())(())(()(()(())(
(()()())(()(())(()()))))))))())())()))())))())()(()))())))())(((())()(((((()())(()())()(()
()))))()((()()()(()())(())()(((()))()())((((()(()()())))(()))(()()()())(())())())))()))((()())()))(((((()()((()(()))()()))()()(...

output:

12
13
14
7
1
6
3
8
4
2
5
9
10
11

result:

ok good plan

Test #53:

score: 0
Accepted
time: 12ms
memory: 65928kb

input:

3711
(
)(
)(
(
)(()
((
(
(
))
(
))())
(
)((
)
)
))))
)
)
(
)
((
(
)((
()
(
(
()))
()(()
)(()((
)
(
)
)((
)))))
(
)(
)(((
)((((((
)
((
()()()(((
)
)()
)(
)()())
(
((
(((
)
(
)(
)
)(
((
)(()
)
(
(()())))))(
(
(
()(
())
(
)((
)
()(
)
)((
()
(
)
)())
)(
()(
)(
)
)))))(
)(
(
()()
(
)))(((
)
)(()()(
(
(()...

output:

1
4
6
7
8
10
12
19
21
22
24
25
26
28
31
35
40
41
46
47
48
50
54
57
59
60
61
63
66
69
70
74
79
80
81
85
86
87
88
91
92
94
95
99
105
106
107
109
110
111
113
115
116
117
118
120
123
125
129
131
134
135
136
138
139
140
144
145
149
152
153
156
158
159
162
164
167
169
170
173
174
175
177
181
183
189
193
1...

result:

ok good plan

Test #54:

score: 0
Accepted
time: 20ms
memory: 65940kb

input:

7863
(
)
)
)
)
))
(
(
(
)
)
(
(
)
((
(
)
)
(
(
)
(
(
(
)
(
)
)
)
)
(
)
(
)
)
)
(
(
)
)
)
)
(
((
(
)
((
(
)
))
(
)
((
(
)
(
)
(
(
(
(
(
)
)
(
)
(
()
)
)
(
(
)
)
(
)
)
(
(
)
)
)
(
)
))
(
)
)
)
)
(
(
(
(
(
(
)
(
(
)
)
(
)
(
(
)
(
(
()
)
(
)
)
)
(
(
)
)
)
(
((
(
)
)(
()
)
)
)(
(
)
)
)
)
(
)
(
(
)
(
(
)
...

output:

1
7
8
9
12
13
15
16
19
20
22
23
24
26
31
33
37
38
43
44
45
47
48
51
53
54
56
58
59
60
61
62
65
67
68
71
72
75
78
79
83
86
91
92
93
94
95
96
98
99
102
104
105
107
108
109
111
115
116
120
121
122
125
129
134
136
137
139
140
144
146
147
148
149
151
152
153
155
158
160
161
162
163
165
167
168
169
171
17...

result:

ok good plan

Test #55:

score: 0
Accepted
time: 20ms
memory: 65948kb

input:

2272
)
)
(
)
)
(()()
(
))()((()((
)
()(
))
))
(
)((
()
)(((
(()))()
))(((((
)
)
)()((((
(()(((
)())()
()(()
)(
)()(((
()
(((
))
))
()
(
(
()
)
(
(
(
((((()()((()
((
)
(
)
)((
)((
)((
((
((
(
((
(
())
)
(
()
(
)()(())
)
())(
(())()
(())((
))
)()()())
(()))(
()
(
)(
())
())()((
)((
))
((((
(()(
))()()...

output:

3
6
7
10
13
15
22
24
27
28
31
32
33
34
36
37
38
39
40
42
47
48
49
50
51
54
55
56
60
61
65
66
72
73
75
76
77
79
83
84
87
89
90
91
92
96
97
98
100
105
106
109
110
111
112
113
114
121
122
123
124
127
129
130
131
133
135
136
138
139
140
143
146
147
148
149
150
155
158
159
161
162
169
170
174
178
179
183...

result:

ok good plan

Test #56:

score: 0
Accepted
time: 15ms
memory: 65900kb

input:

4127
)
)(
)
(
)
)
()(
)
)(
(
)
))
)())
((
((
)()(
(
(
(
)
)
((())
(
(
(
)(
)((
)((
)()
)
))
(
(
)
(
)
)
(
(
)
((
((
()
(
())
(
(
))
(
(
(
(
()
)
())
)(
))
)
(
))
)(
)
(((
(
)
)
(
()
)(
)
(
(
(
)
(
((
(
)))
(
(
)(
(((
)(
())
)
()
)
)
)
)
()((
()
)()
(
(
(
(
(
)
)(
(
)()
)
)
(
(
()(((
()
))
((
()
)
)
...

output:

4
7
10
14
15
17
18
19
22
23
24
25
32
33
35
38
39
41
42
43
44
46
47
49
50
51
52
53
59
63
64
67
68
71
72
73
75
76
77
79
80
82
86
91
92
94
95
96
97
98
101
105
106
107
108
110
111
117
119
123
125
133
134
138
140
142
146
150
151
153
163
164
165
167
168
170
173
174
175
176
178
179
180
188
190
191
193
195
...

result:

ok good plan

Test #57:

score: 0
Accepted
time: 15ms
memory: 66068kb

input:

5314
)
)
((
(
(
)
)()
)
(
)
)))
(((()(
)
()(
())
)
(
(
()
)))
)
)(
()
(
(
()(
(
(
))
(())
)((
))
(
))
)(
(
(
(
(((
(
((
(
)
(
((
(
)
))(
)
))
(
)
))(
(
(
)))
))
(
)(
(
(((
)))
(())((
)(
())(
(
()
()
(
(
(
)(
)
(
)
)
))
(()
)()
()
(
(
(
())
()(
)
(
)
(
(
(
(
)
)(
)()(
)
)
)(
)
)
(
(
)(
((
)()
))
)
(
...

output:

3
4
5
9
12
14
17
18
19
23
24
25
26
27
28
30
33
36
37
38
39
40
41
42
44
45
46
51
54
55
58
60
61
63
66
67
68
69
70
71
74
78
80
81
82
83
85
87
89
90
91
92
101
102
104
108
111
113
114
116
117
118
121
122
124
125
126
127
129
130
131
133
135
136
137
143
144
146
152
153
154
155
158
161
163
164
165
167
169
...

result:

ok good plan

Test #58:

score: 0
Accepted
time: 8ms
memory: 65904kb

input:

3465
(
)
)
(()
(
)()
(
(
)
)
)((
)((
(
)
)))
((
)
)
)(()
(
((
)
)(
(((((
(
)
(
))(
(
(()
))()(
)
))
(
(
(
))
)(
(
((
(
(
)
)
(
)
)
(
)
())
(
(
((
)
)(
)
(
)
)()((
(
)(
)))
(
)
)
(((
)
))(
()
)))
)))
(
(
)
)
)
)()))
)
((
(((()
)
)
)
)
(
))(
)
(
)
)
))(()((
()
)))
(
(
(
)
)(
(
)((((
)()
)
)
(
))((
())...

output:

1
4
5
7
8
13
16
20
21
24
25
27
29
30
34
35
36
39
40
41
42
45
48
51
52
53
57
60
63
66
69
72
73
79
80
85
88
92
94
95
96
99
104
108
111
113
115
118
120
121
124
125
127
131
133
134
135
136
138
141
142
143
144
145
148
154
163
164
166
167
169
171
176
177
183
184
187
188
189
190
191
192
195
201
205
206
208...

result:

ok good plan

Test #59:

score: 0
Accepted
time: 16ms
memory: 65932kb

input:

3992
)())(()(
((
))
((())
(())
)()
)
()(
(
)
(
((
(
)()
(
()))
)((
())
(
)
()
(
(()))
)(
((
(
)
(())(
((
))
((
)
)
)
)
())
(
(((
(
()
)
()))(()
(
)(
))
(
(()(
()
(
)
()))
)(
)(
())))(
)())
(
))
(
(((
)
))
(
(
)((
()
)
(((
)
(
))
)
()
(
)
(
(((((
(
)
((()()((())
))
(
()()
)(
(
)(
)(
(
(
)
)(())(
)(((...

output:

2
4
5
8
9
11
12
13
15
19
21
22
25
26
28
29
31
37
38
39
40
43
46
47
48
49
56
58
59
62
63
65
67
69
72
73
75
76
77
79
81
82
84
87
88
92
94
95
99
100
102
105
106
108
109
110
111
113
115
116
119
120
125
127
129
131
132
137
140
141
143
144
148
150
151
152
154
156
162
164
167
174
176
178
180
181
182
186
19...

result:

ok good plan

Test #60:

score: 0
Accepted
time: 11ms
memory: 65872kb

input:

127
)))()())))))))()((
))((()(((
))(()((())))((()()(((()(()(()(()()(((())(())())(())
)()((())()(())))()))())()(()()))
))((()())((((((
()()()((
(())(()((()((()(()))())(((())())())))())(()(
)(()))))()))()(((()(()()()()()()))(
)((())())
()(()()(()(())))())())))))))
)()))()(())())()))))())
((()))))))()(...

output:

6
7
22
66
68
69
73
95
97
98
102
105
106
110
122
125
14
18
27
34
35
36
55
56
65
71
77
84
86
87
94
107
112
113
2
3
5
40
72
74
78
90
91
96
118
28
44
63
64
70
93
103
124
23
61
75
80
83
100
45
67
43
119
120
13
42
24
88
41
114
54
19
53
17
21
32
59
60
85
104
8
1
12
26
30
37
49
57
81
99
101
20
31
46
50
52
5...

result:

ok good plan

Test #61:

score: 0
Accepted
time: 7ms
memory: 65944kb

input:

7074
(
(
)
(
(
(
(
)
)
)
(
)
)
(
)
)
(
(
(
(
)
(
)
)
)
(
(
)
)
))
(
(
)
)
(
(
(
(
(
(
(
)
)
)
)
(
)
(
)
(
)
)
(
)
(
)
()
)
(
)
(
)
(
(
(
)
)
)
(
)
(
(
)
)
)
(
)
(
(
)
)
(
(
(
(
)
)
)
((
)
(
()
)
)
)
)
(
(
(
)
(
)
((
)
)
)
(
(
(
(
(
)
)
(
(
(
(
)
)
(
(
(
(
(
)
(
)
(
)
)
(
)
(
(
(
(
(
(
)
)
(
)
)
)
)
...

output:

1
2
4
5
6
7
11
14
17
18
19
20
22
26
27
31
32
35
36
37
38
39
40
41
46
48
50
53
55
57
59
61
63
64
65
69
71
72
76
78
79
82
83
84
85
89
91
92
97
98
99
101
103
107
108
109
110
111
114
115
116
117
120
121
122
123
124
126
128
131
133
134
135
136
137
138
141
150
154
158
160
164
165
166
170
174
175
176
179
1...

result:

ok good plan

Test #62:

score: 0
Accepted
time: 11ms
memory: 65952kb

input:

61
)
)
(
)
)
((
)
)
)
)
(
(
(
)(
))
(
(
(
))
()
)
)
)(
(
(
()
)
(
(
((
(
)(((
()(
(
(
))
)
))
)
(
))
)
(
(
(
(
)()
)
)
(
(
()
(
)
)()
)
(
)
(
(
))(

output:

3
6
11
12
13
16
17
18
20
24
25
26
28
29
30
31
33
34
35
40
43
44
45
46
50
51
52
53
57
59
60
14
23
32
61
1
2
4
5
7
8
9
10
15
19
21
22
27
36
37
38
39
41
42
47
48
49
54
55
56
58

result:

ok good plan

Test #63:

score: 0
Accepted
time: 19ms
memory: 65948kb

input:

11
))()()(
))
(
(
(()
(()
)(()())((
)))()((
(())
())((
))

output:

3
4
5
6
9
7
10
8
1
2
11

result:

ok good plan

Test #64:

score: 0
Accepted
time: 12ms
memory: 65872kb

input:

86
)
)
)
)
(
)
)
)
((
)
(
)
)
(
)
)
)
((
)
)
)
)
)
)
)
)
(
)
)
(
(
)
)
(
)
)
(
(
(
)
(
(
)
(
)
)
(
(
(
)
(
(
)
(
)
(
(
)
)
(
(
(
)
(
()
(
(
)
(
(
(
(
)
(
)
(
(
()
(
(
)
(
)
(
(
)

output:

5
9
11
14
18
27
30
31
34
37
38
39
41
42
44
47
48
49
51
52
54
56
57
60
61
62
64
65
66
67
69
70
71
72
74
76
77
78
79
80
82
84
85
1
2
3
4
6
7
8
10
12
13
15
16
17
19
20
21
22
23
24
25
26
28
29
32
33
35
36
40
43
45
46
50
53
55
58
59
63
68
73
75
81
83
86

result:

ok good plan

Test #65:

score: 0
Accepted
time: 21ms
memory: 65832kb

input:

45
)
)
((
)
)
(
)
(
(
)
(
)
)
((
))
(
)
(
)
((
(
(
))
((
)
)
)
(
)
)
)
(
(
(
(
)
)(
(
)
)
)
(
(
(
)

output:

3
6
8
9
11
14
16
18
20
21
22
24
28
32
33
34
35
38
42
43
44
37
1
2
4
5
7
10
12
13
15
17
19
23
25
26
27
29
30
31
36
39
40
41
45

result:

ok good plan

Test #66:

score: 0
Accepted
time: 11ms
memory: 65940kb

input:

20
((
)
)))
(
)((
)
(
((()()
(
)(()
(
(
)))
))
))
()(
(
((
())))
(

output:

1
4
7
8
9
11
12
16
17
18
20
5
10
2
3
6
13
14
15
19

result:

ok good plan

Test #67:

score: 0
Accepted
time: 3ms
memory: 65940kb

input:

10
((
(
)
))
)
)
(
(
)
(

output:

1
2
7
8
10
3
4
5
6
9

result:

ok good plan

Test #68:

score: 0
Accepted
time: 15ms
memory: 65804kb

input:

14
)()((())(()
(())
)(()(())((()())
())((())(()()(((())
()(()
)(
))(((
))
(((())
(())
)))))
)
()))(()(()
())

output:

2
5
9
10
1
3
4
6
7
13
8
11
12
14

result:

ok good plan

Test #69:

score: 0
Accepted
time: 16ms
memory: 65860kb

input:

3
())(())()()(
(()
((())))

output:

2
1
3

result:

ok good plan

Test #70:

score: 0
Accepted
time: 11ms
memory: 65856kb

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

score: 0
Accepted
time: 7ms
memory: 65788kb

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

score: 0
Accepted
time: 12ms
memory: 65868kb

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

score: 0
Accepted
time: 15ms
memory: 65864kb

input:

1
()

output:

1

result:

ok good plan

Test #74:

score: 0
Accepted
time: 20ms
memory: 65780kb

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

score: 0
Accepted
time: 16ms
memory: 65764kb

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

score: 0
Accepted
time: 23ms
memory: 65720kb

input:

6
()
)(
((
))
(()
())

output:

1
3
5
2
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed