QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#217641#5108. Prehistoric Programsucup-team1004#AC ✓162ms24456kbC++141.2kb2023-10-17 07:17:292023-10-17 07:17:29

Judging History

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

  • [2023-10-17 07:17:29]
  • 评测
  • 测评结果:AC
  • 用时:162ms
  • 内存:24456kb
  • [2023-10-17 07:17:29]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using ll=long long;
template<typename T>
ostream& operator << (ostream &out,const vector<T>&x){
	if(x.empty())return out<<"[]";
	out<<'['<<x[0];
	for(int len=x.size(),i=1;i<len;i++)out<<','<<x[i];
	return out<<']';
}
template<typename T>
vector<T> ary(const T *a,int l,int r){
	return vector<T>{a+l,a+1+r};
}
template<typename T>
void debug(T x){
	cerr<<x<<'\n';
}
template<typename T,typename ...S>
void debug(T x,S ...y){
	cerr<<x<<' ',debug(y...);
}
const int N=1e6+10,M=1e7+10;
int n;
struct zj{
	int x,y,id;
}a[N];
char str[M];
bool operator < (const zj &a,const zj &b){
	int p=a.x<a.y,q=b.x<b.y;
	if(p^q)return p;
	if(p)return a.x<b.x;
	else return a.y>b.y;
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%s",str+1);
		int len=strlen(str+1),now=0;
		for(int j=1;j<=len;j++){
			if(str[j]=='(')now++;
			else now--;
			a[i].x=max(a[i].x,-now);
		}
		a[i].id=i,a[i].y=now+a[i].x;
		// debug(a[i].x,a[i].y);
	}
	sort(a+1,a+1+n);
	int now=0;
	for(int i=1;i<=n;i++){
		if(now<a[i].x)puts("impossible"),exit(0);
		now+=a[i].y-a[i].x;
	}
	if(now)puts("impossible"),exit(0);
	for(int i=1;i<=n;i++)printf("%d\n",a[i].id);
	return 0;
}

詳細信息

Test #1:

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

input:

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

output:

26315
26345
26341
26339
26336
26334
26333
26329
26328
26327
26321
26320
26318
26317
26316
26347
26313
26311
26308
26307
26305
26302
26297
26295
26294
26292
26290
26289
26286
26384
26414
26413
26412
26409
26406
26402
26401
26399
26398
26396
26395
26394
26393
26285
26383
26382
26380
26376
26370
26366
...

result:

ok good plan

Test #2:

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

input:

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

output:

381
869
408
406
399
398
872
396
390
387
386
384
382
410
876
377
877
372
371
881
356
347
345
335
334
445
473
471
466
464
462
461
460
852
854
452
449
447
894
443
857
439
859
430
427
426
863
422
420
414
217
253
252
247
245
243
242
239
925
229
228
929
223
919
216
215
214
213
212
933
209
208
206
934
935
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
1
3
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

415
210
209
208
207
413
205
414
203
211
416
199
198
196
194
420
192
191
405
234
232
398
399
228
227
226
404
424
406
219
409
410
214
411
412
153
437
439
160
159
158
157
156
440
436
152
442
443
149
445
143
141
449
177
186
184
426
182
427
180
428
178
395
176
429
172
431
434
166
435
362
315
353
311
356
...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

274
625
632
304
635
636
294
287
645
281
648
624
269
651
265
264
263
653
259
258
654
255
341
361
605
606
358
357
609
612
348
345
343
657
338
335
618
333
331
330
326
324
622
191
213
212
672
208
673
204
674
677
195
680
214
681
186
185
184
182
181
180
684
176
175
230
250
658
246
661
243
663
238
664
665
...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 139ms
memory: 15572kb

input:

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

output:

534143
534126
534127
534129
534130
534133
534135
534139
534140
534142
534125
534144
534145
534146
534150
534153
534154
534155
534158
534104
534082
534090
534091
534097
534098
534100
534102
534103
534159
534110
534111
534112
534113
534114
534117
534118
534119
534215
534201
534203
534204
534206
534209...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 22ms
memory: 14512kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 27ms
memory: 15108kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 28ms
memory: 15420kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 27ms
memory: 14588kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 25ms
memory: 10476kb

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

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

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 76ms
memory: 15356kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 81ms
memory: 15484kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

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

input:

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

output:

555562
555542
555544
555546
555548
555550
555552
555554
555556
555558
555560
555540
555564
555566
555568
555570
555572
555574
555576
555578
555580
555520
555502
555504
555506
555508
555510
555512
555514
555516
555518
555582
555522
555524
555526
555528
555530
555532
555534
555536
555538
555644
555624...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 121ms
memory: 24456kb

input:

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

output:

666672
666657
666658
666659
666660
666661
666662
666663
666664
666665
666666
666667
666668
666669
666670
666671
666656
666673
666674
666675
666676
666677
666678
666679
666680
666681
666682
666683
666684
666685
666686
666641
666626
666627
666628
666629
666630
666631
666632
666633
666634
666635
666636...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 162ms
memory: 15564kb

input:

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

output:

206352
578956
206360
206359
578966
578975
578977
578984
578989
578955
206350
578997
579001
579005
206342
579014
579017
579019
206374
578928
206383
578935
206380
578939
578941
578942
578943
206338
578944
206371
578950
206367
206366
206365
578953
578954
206307
579052
579053
206314
579063
206311
579064...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 157ms
memory: 15496kb

input:

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

output:

578993
206267
578977
206265
578981
206262
578982
578987
578989
578975
206256
206255
206253
578999
579001
579002
579005
579009
578946
206290
206289
578929
206286
578932
206283
578938
578941
579021
206279
578950
578955
206274
578969
206271
578970
578974
206209
579081
206219
579082
579085
206215
579095...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 27ms
memory: 3916kb

input:

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

output:

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

result:

ok good plan

Test #41:

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

input:

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

output:

48
12
75
7
81
36
33
76
99
16
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
73
35
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
37
74
18
104
49
70
42
38
83...

result:

ok good plan

Test #42:

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

input:

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

output:

43385
45096
5059
32732
18358
49599
45097
18361
29561
38326
15039
38325
26278
56210
29564
5042
32752
56208
24159
60109
9957
49583
38315
18383
9958
29554
52202
52203
49610
32702
60070
5091
18336
29572
18338
60074
9918
5085
15055
38347
40801
56229
38308
24179
15054
60079
52189
9925
9927
52192
29568
408...

result:

ok good plan

Test #43:

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

input:

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

output:

657739
309439
309437
138853
309436
554392
657741
138858
657740
554395
309424
309422
138863
554387
657738
138866
309418
309417
138869
657733
657732
657731
309416
309415
138875
554383
554377
309462
657762
138827
554380
138830
657761
309456
309455
309454
309453
138876
309451
309448
657754
138840
657752...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

25
21
5
11
19
14
9
12
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: 3896kb

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

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: 1ms
memory: 3876kb

input:

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

output:

2515
2501
1142
2504
2506
2507
2509
1137
1136
2512
1133
1132
2514
1145
1129
1128
1127
2516
2528
1118
2529
1116
2531
2532
2535
1158
1175
1174
2465
1170
1169
2466
1166
2472
1162
2475
1160
1111
1157
2482
2488
2489
1153
2493
2495
2497
2499
1147
1146
2597
2585
1072
1071
2587
1069
2589
1064
1063
2591
1061
...

result:

ok good plan

Test #54:

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

input:

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

output:

3182
3195
3192
6283
3190
3188
3186
6286
6287
3196
3181
3180
3176
3175
6294
3169
6296
3166
6277
6271
3212
6273
6274
6275
6276
3207
3206
3165
3204
3203
3202
6279
3199
6280
3197
3135
3144
3143
3142
6306
3140
3139
3138
3137
3145
6309
6310
3131
3130
3129
6311
3125
6299
3163
3162
3161
3160
3159
6298
3157
...

result:

ok good plan

Test #55:

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

input:

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

output:

1145
1172
1167
1163
1162
1159
1157
1156
1149
1146
1174
1143
1141
1136
1134
1132
1127
1126
1120
1199
1226
1222
1220
1217
1215
1211
1202
1200
1119
1198
1187
1185
1184
1182
1179
1177
1176
1037
1061
1057
1055
1050
1048
1047
1044
1039
1065
1035
1024
1017
1012
1010
1007
1002
1000
1099
1118
1117
1112
1108
...

result:

ok good plan

Test #56:

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

input:

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

output:

1265
2767
2768
1278
1277
1276
2769
1274
2770
2772
2774
1269
1268
2776
2779
2766
1264
2781
1260
2791
2794
2798
1255
1254
2800
2804
2805
2806
1248
1299
1316
2716
1313
1312
1311
1310
1309
2718
1307
2720
2726
2728
1301
2731
1247
2735
2737
2741
2743
1294
2746
2748
2752
1289
1288
2758
1285
1284
1196
1214
...

result:

ok good plan

Test #57:

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

input:

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

output:

2111
2097
2098
2099
2100
2101
4287
4285
2106
2109
2110
4289
4283
2113
2116
2118
2119
2122
4277
4276
2126
4297
2064
2065
4308
2069
4305
4304
2075
2076
4301
4300
2128
2082
2083
2084
4296
4295
4294
2091
2092
2094
2186
2163
2164
2167
4260
4259
2173
2176
2177
2182
2183
4265
4251
2190
4249
2194
4247
2196
...

result:

ok good plan

Test #58:

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

input:

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

output:

2926
1196
2916
2919
2493
1188
1187
2492
1185
1182
2924
1179
1177
1197
1175
2927
1173
1172
2929
1167
2490
1165
1163
2932
1161
2119
2908
2899
2900
1231
2901
2902
1228
1227
1223
1221
2905
2906
1215
2934
1213
1211
2910
2912
1205
2913
2109
1201
1200
1199
2495
2961
1126
2951
1124
1122
2952
2954
1118
1117
...

result:

ok good plan

Test #59:

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

input:

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

output:

2072
2062
2063
2064
2066
2067
2068
2069
2071
2060
2079
2083
2084
2085
2086
2087
2090
2035
2016
2019
2020
2022
2027
2031
2032
2033
2093
2036
2040
2050
2053
2056
2057
2059
2169
2155
2156
2158
2162
2163
2166
2167
2168
2154
2170
2171
2172
2173
2176
2178
2180
2135
2104
2108
2120
2121
2123
2126
2127
2130
...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

2894
5628
2874
2875
2876
2878
2879
2880
2881
2882
2885
5623
2888
2890
2891
5620
2870
5617
5615
2899
5610
2905
5608
5607
5606
2911
2912
2913
2914
5605
2916
5604
2848
2829
2830
5650
2832
5649
2836
5646
5645
2839
2840
5644
2842
5642
2846
5640
5603
2851
5637
2853
2854
5636
2856
2857
2863
2864
2865
5630
...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

3
4
5
6
7
10
8
1
2
9
11

result:

ok good plan

Test #64:

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

input:

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

output:

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

result:

ok good plan

Test #65:

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

input:

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

output:

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

result:

ok good plan

Test #66:

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

1
2
7
8
10
3
4
5
6
9

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

3
5
2
1
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed