QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#390914#5108. Prehistoric ProgramsnocrizAC ✓199ms30764kbC++141.3kb2024-04-16 07:44:442024-04-16 07:44:45

Judging History

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

  • [2024-04-16 07:44:45]
  • 评测
  • 测评结果:AC
  • 用时:199ms
  • 内存:30764kb
  • [2024-04-16 07:44:44]
  • 提交

answer

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

#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<int> vi;


int main() {
	cin.tie(0)->sync_with_stdio(0);
	cin.exceptions(cin.failbit);
	int n;
	cin>>n;
	vector<pair<pii, int>> V0, V1;

	int tsu = 0;
	for(int i=0;i<n;i++) {
		string s;
		cin>>s;
		int su = 0, mi = 0;
		for(auto ct:s) {
			su += (ct == '(')?1 : -1;
			mi = min(mi, su);
		}
		tsu += su;
		if(su > 0) {
			V0.push_back(make_pair(make_pair(-mi, su), i+1));
		} else {
			V1.push_back(make_pair(make_pair(su-mi, -su), i+1));
		}
	}
	if(tsu != 0)  {
			cout<<"impossible\n";
			return 0;
		}
	sort(V0.begin(), V0.end());
	sort(V1.begin(), V1.end());
	vector<int> ans0, ans1;
	int cs = 0;
	for(auto ct: V0) {
		if(cs-ct.first.first < 0) {
			cout<<"impossible\n";
			return 0;
		}
		cs += ct.first.second;
		ans0.push_back(ct.second);
	}
	cs = 0;
	for(auto ct: V1) {
		if(cs-ct.first.first < 0) {
			cout<<"impossible\n";
			return 0;
		}
		cs += ct.first.second;
		ans1.push_back(ct.second);
	}
	for(auto ct: ans0) {
		cout<<ct<<'\n';
	}
	reverse(all(ans1));

	for(auto ct: ans1) {
		cout<<ct<<'\n';
	}
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 4236kb

input:

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

output:

1
2
5
8
9
10
11
12
14
16
19
23
27
28
30
32
34
35
37
38
42
43
44
55
58
59
61
70
72
79
80
87
91
92
93
94
95
96
97
99
112
116
118
120
122
125
126
127
128
131
135
136
146
147
148
149
150
151
165
166
175
177
179
181
182
183
185
186
187
191
192
193
194
195
196
199
205
207
209
210
211
218
220
225
229
230
2...

result:

ok good plan

Test #2:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

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

output:

1
3
10
12
14
18
22
54
58
64
65
75
77
89
90
92
97
101
104
106
110
122
125
126
135
136
143
147
162
166
178
179
181
182
188
189
190
198
206
209
212
213
215
216
217
223
228
229
242
243
245
247
252
253
265
267
268
280
282
287
290
291
301
309
313
335
347
356
371
372
377
381
382
396
398
399
408
410
420
426...

result:

ok good plan

Test #3:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

2
()
()

output:

2
1

result:

ok good plan

Test #4:

score: 0
Accepted
time: 0ms
memory: 3840kb

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

3
()
(
)

output:

2
3
1

result:

ok good plan

Test #7:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

score: 0
Accepted
time: 0ms
memory: 3844kb

input:

5
))(
(()
)(
(
)

output:

2
4
1
3
5

result:

ok good plan

Test #9:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

3
((
))())
(

output:

3
1
2

result:

ok good plan

Test #10:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

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

output:

impossible

result:

ok impossible

Test #11:

score: 0
Accepted
time: 0ms
memory: 3892kb

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
75
76
77
78
79
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
171
1...

result:

ok good plan

Test #12:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

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

output:

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

result:

ok good plan

Test #13:

score: 0
Accepted
time: 0ms
memory: 3820kb

input:

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

output:

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

result:

ok good plan

Test #14:

score: 0
Accepted
time: 0ms
memory: 3864kb

input:

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

output:

4
6
15
32
35
37
40
49
52
73
79
92
94
100
104
111
140
141
143
149
11
14
38
60
69
84
87
106
7
28
148
120
12
24
98
142
105
17
10
16
133
27
51
70
23
62
91
135
61
89
93
77
147
29
102
122
9
3
2
25
125
86
43
47
18
56
134
150
59
45
30
19
21
33
55
8
121
126
71
72
95
57
85
50
124
88
146
132
115
41
110
127
67
...

result:

ok good plan

Test #15:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

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

output:

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

result:

ok good plan

Test #16:

score: 0
Accepted
time: 0ms
memory: 3548kb

input:

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

output:

8
30
36
48
55
58
60
65
67
74
81
93
97
99
106
108
110
111
118
123
136
149
52
75
92
122
130
140
45
117
27
115
84
131
50
129
1
11
31
56
24
70
42
46
88
100
127
63
119
82
146
120
35
101
15
114
37
107
133
43
32
78
90
12
44
61
112
7
64
109
125
85
72
144
41
22
20
95
28
16
71
94
139
103
113
4
132
23
34
39
13...

result:

ok good plan

Test #17:

score: 0
Accepted
time: 1ms
memory: 3724kb

input:

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

output:

7
9
13
16
17
20
21
22
27
37
45
48
57
62
65
66
67
69
74
81
82
95
97
101
112
116
121
136
138
141
148
150
152
155
157
159
160
162
169
172
175
176
181
182
184
185
186
191
195
208
212
213
214
220
224
225
227
228
229
231
238
243
250
255
258
259
263
264
265
281
287
294
304
324
326
330
331
333
335
338
343
3...

result:

ok good plan

Test #18:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

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

output:

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

result:

ok good plan

Test #19:

score: 0
Accepted
time: 0ms
memory: 3656kb

input:

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

output:

impossible

result:

ok impossible

Test #20:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

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

output:

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

result:

ok good plan

Test #21:

score: 0
Accepted
time: 0ms
memory: 3680kb

input:

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

output:

1
2
4
6
7
8
9
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
65
73
75
77
80
82
83
85
95
96
97
98
79
60
78
92
66
99
93
76
15
64
30
74
100
94
91
90
89
87
86
84
81
72
71
70
68
67
63
62
61
57
51
50
47
44
43
40
39
34
32
27
25
24
23
20
17
16
13
12
11
10
5
3
88
69
14

result:

ok good plan

Test #22:

score: 0
Accepted
time: 0ms
memory: 3856kb

input:

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

output:

impossible

result:

ok impossible

Test #23:

score: 0
Accepted
time: 0ms
memory: 3628kb

input:

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

output:

impossible

result:

ok impossible

Test #24:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 161ms
memory: 24252kb

input:

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

output:

2
4
5
6
8
9
13
23
28
29
30
31
36
37
38
42
44
49
52
54
55
63
65
66
69
74
77
82
86
87
88
89
90
91
94
95
98
99
100
104
106
110
111
112
117
119
120
122
135
139
140
142
143
147
149
150
151
153
156
159
164
168
170
172
177
179
180
181
183
190
193
197
200
203
207
208
212
219
220
221
223
224
225
226
227
228
...

result:

ok good plan

Test #26:

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

input:

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

output:

impossible

result:

ok impossible

Test #27:

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

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 18ms
memory: 20716kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

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

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 9ms
memory: 20008kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 30ms
memory: 16008kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 34ms
memory: 15772kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 93ms
memory: 21128kb

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: 98ms
memory: 30764kb

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: 199ms
memory: 24440kb

input:

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

output:

11
13
21
29
37
40
49
84
87
90
102
133
154
155
159
174
181
183
191
194
215
222
223
237
240
249
250
260
269
292
294
331
335
344
351
370
373
387
394
412
442
446
452
454
491
502
506
519
540
553
573
591
603
613
617
623
626
629
633
641
657
664
668
682
688
697
701
703
723
728
732
738
769
779
805
824
830
83...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 197ms
memory: 26080kb

input:

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

output:

5
12
15
38
44
47
59
87
99
101
104
115
126
134
138
143
163
168
171
180
187
190
225
228
232
233
239
243
247
259
260
274
315
319
322
335
343
352
353
365
367
368
392
399
424
434
435
439
456
470
475
490
494
508
509
517
531
560
565
605
614
632
636
643
653
660
673
677
680
692
694
719
724
726
746
752
755
75...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 9ms
memory: 3884kb

input:

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

output:

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

result:

ok good plan

Test #41:

score: 0
Accepted
time: 6ms
memory: 4348kb

input:

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

output:

48
12
75
7
81
33
36
76
16
99
10
105
59
108
22
15
5
69
87
9
55
84
3
66
80
39
78
8
46
21
96
95
53
51
6
62
64
13
23
97
27
52
65
28
68
2
31
1
34
19
25
32
4
77
100
30
11
86
20
14
50
35
73
67
47
88
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
74
37
18
104
49
70
42
38
83...

result:

ok good plan

Test #42:

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

input:

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

output:

60
146
195
198
210
410
446
566
673
711
887
904
972
1004
1022
1241
1324
1464
1622
1702
1772
1813
1816
1862
1954
2011
2082
2305
2390
2595
2713
2830
2953
3010
3025
3088
3216
3326
3438
3750
3764
3804
3874
3978
4297
4427
4573
4647
4760
4806
4886
5059
5209
5234
5282
5360
5467
5543
5758
6086
6325
6460
6498...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 153ms
memory: 18144kb

input:

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

output:

29
41
69
84
89
109
145
156
171
180
189
206
225
235
252
257
265
282
301
305
314
353
365
384
385
388
395
404
409
415
429
441
442
455
476
485
500
505
517
534
574
581
613
617
632
636
658
668
677
688
699
714
731
744
753
755
760
764
767
773
775
782
806
810
831
836
881
899
901
905
909
915
921
930
935
945
9...

result:

ok good plan

Test #44:

score: 0
Accepted
time: 1ms
memory: 3660kb

input:

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

output:

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

result:

ok good plan

Test #45:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

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

output:

6
3
7
2
1
8
5
4

result:

ok good plan

Test #46:

score: 0
Accepted
time: 0ms
memory: 3620kb

input:

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

output:

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

result:

ok good plan

Test #47:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

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

output:

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

result:

ok good plan

Test #48:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

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

output:

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

result:

ok good plan

Test #49:

score: 0
Accepted
time: 0ms
memory: 3812kb

input:

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

output:

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

result:

ok good plan

Test #50:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

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

output:

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

result:

ok good plan

Test #51:

score: 0
Accepted
time: 0ms
memory: 3652kb

input:

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

output:

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

result:

ok good plan

Test #52:

score: 0
Accepted
time: 0ms
memory: 3648kb

input:

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

output:

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

result:

ok good plan

Test #53:

score: 0
Accepted
time: 1ms
memory: 3704kb

input:

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

output:

1
4
7
8
10
12
19
22
25
26
28
31
35
46
50
57
59
60
61
63
66
70
74
79
81
85
86
88
95
105
106
107
115
118
123
125
129
135
138
139
140
145
149
153
156
164
167
169
175
181
189
196
198
200
201
206
210
212
217
226
227
231
234
236
238
240
242
244
246
252
262
267
271
272
280
281
285
288
290
292
295
299
301
3...

result:

ok good plan

Test #54:

score: 0
Accepted
time: 0ms
memory: 3716kb

input:

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

output:

1
7
8
9
12
13
16
19
20
22
23
24
26
31
33
37
38
43
45
48
51
54
56
58
59
60
61
62
65
67
71
72
75
78
79
83
86
91
92
93
94
95
96
98
99
102
104
105
107
108
111
115
116
120
122
129
134
136
137
139
140
144
146
147
148
149
151
152
153
155
161
162
163
167
168
169
171
172
173
174
175
176
177
179
181
183
184
1...

result:

ok good plan

Test #55:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

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

output:

3
6
7
10
13
24
32
33
36
37
38
42
49
51
54
56
66
75
79
83
84
87
89
92
97
105
112
121
122
123
127
136
138
140
143
146
147
148
149
155
158
159
178
179
183
196
198
201
203
209
222
226
227
228
229
230
236
253
261
266
268
273
276
284
285
291
294
296
298
305
308
316
320
322
324
331
337
346
349
353
360
362
...

result:

ok good plan

Test #56:

score: 0
Accepted
time: 1ms
memory: 3760kb

input:

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

output:

4
7
10
17
18
19
22
23
24
25
32
33
35
38
39
44
46
47
49
50
51
52
59
64
67
71
72
73
75
77
79
80
94
95
96
97
98
101
105
106
117
123
125
133
138
142
146
150
151
153
163
168
173
174
180
188
190
191
193
212
217
221
222
223
226
230
231
232
235
237
239
242
244
245
247
249
251
254
255
256
258
259
263
268
269...

result:

ok good plan

Test #57:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

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

output:

4
5
9
14
17
18
24
25
26
27
28
33
36
37
38
40
42
44
46
51
54
55
58
60
66
69
70
71
74
78
81
82
83
85
87
89
90
91
92
101
102
108
111
116
117
118
121
122
124
125
129
131
133
135
136
137
143
146
154
161
163
164
167
169
170
173
181
182
188
192
194
195
197
206
217
218
219
222
225
226
228
233
235
237
239
24...

result:

ok good plan

Test #58:

score: 0
Accepted
time: 1ms
memory: 3932kb

input:

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

output:

1
4
5
7
8
13
20
25
27
29
30
34
35
36
39
41
42
45
48
51
52
57
60
63
72
73
85
88
94
95
96
99
104
111
115
118
120
121
124
125
127
131
133
135
136
138
141
145
148
154
164
166
169
176
177
183
184
187
188
189
190
191
192
195
210
211
212
213
223
224
225
230
244
245
250
254
255
258
262
263
265
267
268
269
2...

result:

ok good plan

Test #59:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

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

output:

4
8
9
11
13
15
19
22
26
28
37
39
43
46
49
56
58
62
63
69
73
75
77
81
84
87
88
92
95
100
105
106
109
116
120
125
129
131
140
141
143
144
150
151
154
156
164
167
174
181
186
190
191
194
196
203
206
214
216
219
221
224
225
228
231
239
244
251
256
257
260
264
265
266
268
270
271
275
277
280
284
286
290
...

result:

ok good plan

Test #60:

score: 0
Accepted
time: 0ms
memory: 3600kb

input:

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

output:

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

result:

ok good plan

Test #61:

score: 0
Accepted
time: 1ms
memory: 3724kb

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
59
61
63
64
65
69
71
72
76
78
79
82
83
84
85
91
97
98
99
101
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
180
182
186
187
19...

result:

ok good plan

Test #62:

score: 0
Accepted
time: 0ms
memory: 3640kb

input:

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

output:

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

result:

ok good plan

Test #63:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

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

output:

3
4
5
6
7
10
8
1
11
2
9

result:

ok good plan

Test #64:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

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

output:

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

result:

ok good plan

Test #65:

score: 0
Accepted
time: 0ms
memory: 3580kb

input:

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

output:

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

result:

ok good plan

Test #66:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

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

output:

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

result:

ok good plan

Test #67:

score: 0
Accepted
time: 0ms
memory: 3536kb

input:

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

output:

2
7
8
10
1
4
9
6
5
3

result:

ok good plan

Test #68:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

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

output:

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

result:

ok good plan

Test #69:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

score: 0
Accepted
time: 0ms
memory: 3684kb

input:

1
()

output:

1

result:

ok good plan

Test #74:

score: 0
Accepted
time: 0ms
memory: 3884kb

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

score: 0
Accepted
time: 0ms
memory: 3636kb

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

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

output:

5
3
2
4
6
1

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed