QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#873584#5108. Prehistoric ProgramshhironAC ✓431ms47832kbC++14989b2025-01-26 17:44:572025-01-26 17:44:58

Judging History

This is the latest submission verdict.

  • [2025-01-26 17:44:58]
  • Judged
  • Verdict: AC
  • Time: 431ms
  • Memory: 47832kb
  • [2025-01-26 17:44:57]
  • Submitted

answer

#include<bits/stdc++.h>
#define INF 0x7fffffff
typedef long long ll;
using namespace std;
const int N=2e6+6;
int n;
struct node{
	int minn,val,id;
	bool operator <(const node &rhs)const{
		return minn<rhs.minn;
	}
};
struct node1{
	int id,val;
	bool operator <(const node1 &rhs)const{
		return val<rhs.val;
	}
};
string s;
priority_queue<node> q;
priority_queue<node1> p;
int ans[N];
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		cin>>s;
		int len=s.length();
		int num=0,sum=0;
		for(int j=1;j<=len;j++){
			if(s[j-1]=='(') sum++;
			else sum--;
			num=min(num,sum);
		}
		q.push((node){num,sum,i});
	}
	bool lrc=1;
	int nown=0;
	for(int i=1;i<=n;i++){
		while(!q.empty()&&q.top().minn+nown>=0) p.push((node1){q.top().id,q.top().val}),q.pop();
		if(p.empty()){lrc=0;break;}
		nown+=p.top().val;
		ans[i]=p.top().id;
		p.pop();
	}
	if(!lrc||nown!=0) puts("impossible");
	else for(int i=1;i<=n;i++) printf("%d\n",ans[i]);
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 21ms
memory: 5360kb

input:

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

output:

41248
6827
17933
39338
30523
11635
8378
1194
39997
12662
15203
8282
34305
24534
41357
33154
37628
20200
29189
45720
27739
40093
38177
35948
32454
28930
42456
12655
48879
12299
46182
4238
21094
13809
18388
49233
21519
44459
35822
33371
9449
27579
3502
37172
15706
39917
48479
4704
40407
30710
5338
674...

result:

ok good plan

Test #2:

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

input:

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

output:

36
980
537
519
480
472
634
13
745
194
994
66
386
896
186
44
776
354
904
966
532
645
585
167
946
488
571
132
694
38
159
587
264
286
218
141
257
83
127
39
448
417
595
478
476
598
329
107
507
814
214
720
543
907
981
427
111
62
700
362
662
707
300
956
780
349
260
131
384
807
91
53
845
676
150
321
116
58...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

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: 3840kb

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
5
1

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

479
311
448
329
255
443
199
483
146
232
253
265
335
297
414
211
80
357
350
177
247
436
378
381
59
191
439
95
58
23
94
256
219
11
258
129
10
128
262
254
60
4
131
130
109
65
192
29
388
264
66
133
194
132
269
480
96
271
268
442
393
33
440
392
275
274
395
277
139
1
495
445
196
136
283
398
282
141
241
39...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

49
23
39
29
140
16
85
45
112
129
74
145
75
149
62
41
88
63
100
142
121
55
150
70
144
32
7
51
21
102
19
107
86
34
104
82
117
64
84
98
148
61
37
36
2
8
87
52
10
44
53
89
94
46
113
26
127
118
128
5
80
141
58
14
56
50
90
114
76
42
15
136
18
66
4
13
92
103
25
71
35
78
54
28
139
105
57
133
147
99
59
119
7...

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

468
54
142
423
205
234
744
163
415
365
702
379
390
127
327
472
421
713
204
540
579
439
396
102
85
539
313
544
746
707
734
590
585
642
122
4
646
1
655
46
601
405
658
657
161
47
12
104
274
34
99
79
236
180
216
202
535
473
342
158
316
547
614
149
108
571
321
453
485
706
681
482
125
290
25
705
325
328
2...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 341ms
memory: 36824kb

input:

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

output:

149392
734985
320653
685162
392718
468537
91935
308736
335762
408311
931678
48832
898628
645366
466001
630655
837214
941474
22275
225116
948877
253030
700314
563491
499682
453729
438053
303619
58321
580393
113902
961246
352529
190553
613993
642440
276986
382014
279446
58358
181228
611091
968685
1794...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 122ms
memory: 19664kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 124ms
memory: 19672kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

score: 0
Accepted
time: 126ms
memory: 19668kb

input:

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

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 126ms
memory: 19672kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 122ms
memory: 19672kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 140ms
memory: 11736kb

input:

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

output:

2
1

result:

ok good plan

Test #32:

score: 0
Accepted
time: 124ms
memory: 11732kb

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 119ms
memory: 19720kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 258ms
memory: 37952kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 219ms
memory: 18096kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 342ms
memory: 37344kb

input:

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

output:

2
14
254
65534
131066
262118
524174
524044
261892
523274
522248
130048
258050
507910
991528
958760
893224
762152
524288
762154
893226
381076
762156
958762
446612
762158
381078
893228
190538
95268
991530
479380
893230
762160
762162
446614
381080
762164
958764
223306
762166
381082
111652
190540
762168...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 305ms
memory: 47832kb

input:

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

output:

500001
500003
520192
524272
524277
524250
524198
524094
523887
523465
522629
520956
517614
510925
996977
964217
898685
767614
524303
767612
898686
767608
767600
964221
898684
767584
767552
898680
767490
737879
996986
964222
898672
737883
767622
898656
767621
767620
964220
898624
737887
767626
898562...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 431ms
memory: 37832kb

input:

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

output:

510441
605854
164663
483356
944202
500584
138068
889056
319417
637097
679768
163748
417130
90286
492328
879218
732016
183559
475292
496501
763948
327042
924596
629235
748692
321244
765327
786284
428626
217447
235485
911154
487793
590693
598737
970762
651410
323909
475331
480176
378339
67591
32767
26...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 424ms
memory: 36416kb

input:

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

output:

250826
568499
72642
791925
675014
629151
816445
494698
124285
191981
425960
985988
536620
795023
300744
926090
463859
106383
434240
549647
561779
597972
156606
810035
689231
212168
907373
884793
539400
758663
137311
575206
129338
207485
333208
193769
930603
427235
353729
746420
388609
963161
592419
...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 152ms
memory: 4184kb

input:

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

output:

163
528
314
475
451
399
186
251
440
356
243
190
417
359
396
310
21
352
388
216
75
223
276
357
275
381
403
522
499
266
508
339
106
531
301
158
204
423
375
175
291
392
235
421
236
44
319
479
443
65
561
41
525
73
389
9
347
231
501
405
292
495
255
116
549
413
137
152
277
326
151
426
487
384
85
169
122
1...

result:

ok good plan

Test #41:

score: 0
Accepted
time: 148ms
memory: 4224kb

input:

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

output:

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

result:

ok good plan

Test #42:

score: 0
Accepted
time: 159ms
memory: 5504kb

input:

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

output:

51373
3817
38333
28440
23160
14136
7709
47434
43701
16318
17030
51691
43609
60845
8970
24272
51607
45575
15571
7952
57203
39904
1485
36934
47005
28812
42660
5483
12548
925
47178
18365
59616
36765
41633
27238
35379
63335
60005
28742
29892
16598
14144
24239
13562
63066
10743
44858
39470
60139
56433
17...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 348ms
memory: 31040kb

input:

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

output:

504790
204843
495310
42954
538676
343862
399438
146851
266233
498212
118929
562227
63131
180224
67718
85220
504382
372668
488191
325828
694426
53673
235660
87230
233827
386793
400919
388851
76622
329734
98517
414295
678888
483338
325518
521226
53936
121461
298959
607247
616123
182800
25279
570883
32...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
7
3
1
4
2
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

input:

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

output:

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

result:

ok good plan

Test #53:

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

input:

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

output:

2709
3074
1426
2952
1969
883
38
3641
1641
1378
3417
1706
2860
3584
183
3560
1719
731
3325
2202
2067
549
540
2168
1129
2241
193
1153
2001
1607
1342
3670
3356
1572
919
1838
1836
700
87
1407
1701
1414
2849
485
1705
3692
1949
213
2889
3436
3697
3443
3473
3469
2950
1982
2964
2962
877
256
1037
1753
1521
2...

result:

ok good plan

Test #54:

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

input:

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

output:

2024
7172
515
4936
4898
7783
7337
15
3784
6058
5879
6082
6081
121
7590
7576
3790
2060
6915
3556
7117
47
383
258
1041
2090
4003
1956
3568
2113
4222
4218
6180
529
532
6228
5997
2149
3918
6245
777
1558
3116
6274
1110
4464
2226
3629
1802
6989
6310
564
3605
3602
3165
2279
6355
4389
4417
1153
7238
6388
79...

result:

ok good plan

Test #55:

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

input:

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

output:

1037
1937
271
1146
2179
1730
1700
1431
2065
974
2198
1857
584
39
935
1306
1357
1377
1742
1442
1440
1438
1443
2117
2070
1502
768
2227
2086
2021
139
566
1910
200
821
383
1881
1764
1875
549
367
1620
299
2058
1035
896
1812
22
532
272
1539
2190
543
783
2250
2024
581
292
72
302
1198
1392
1640
413
727
2004...

result:

ok good plan

Test #56:

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

input:

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

output:

1004
3255
3163
2854
3052
2091
1007
1929
1147
3673
3432
2498
857
2653
1316
3759
1789
1718
695
1720
708
1463
2920
3866
3068
1520
384
2027
778
777
775
1047
2113
1580
2183
2180
2211
1065
3655
911
1584
1599
918
1618
2307
1836
1179
584
2978
821
2485
1862
928
1278
652
2588
2575
2608
3383
165
2652
82
167
63...

result:

ok good plan

Test #57:

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

input:

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

output:

3932
3496
4856
180
2783
4937
294
1183
3268
210
1657
2518
412
1860
2771
12
2813
2804
3979
3785
3143
561
4437
2293
4305
1173
1928
3615
144
4363
2387
1606
505
3645
1825
2438
2437
3881
1231
2458
2487
3683
5026
3297
3692
1655
39
5103
126
4511
5143
3344
323
5177
3370
5209
2625
3918
3192
1710
3421
2676
164...

result:

ok good plan

Test #58:

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

input:

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

output:

208
24
974
206
2109
3153
1199
2388
633
1890
1848
1668
701
1401
3358
3344
1413
714
926
3361
1437
717
368
503
1887
377
1031
259
2076
66
2751
3066
144
980
1187
1175
1782
885
2823
2464
2463
2635
620
1827
1799
100
639
1273
80
2283
640
1770
2950
3267
2642
2632
167
1652
1654
1353
2445
3328
699
487
2809
167...

result:

ok good plan

Test #59:

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

input:

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

output:

253
2233
3246
334
2926
1962
287
278
1331
1932
2585
76
2547
3461
708
2781
3957
3476
1886
218
1515
2079
1100
2166
1092
138
3954
1566
246
793
3209
1173
2447
148
2372
299
1197
2440
1213
2436
1836
3320
2571
2711
2767
484
930
2890
1450
3741
3760
1873
180
2112
248
2880
1763
759
3028
1901
3543
887
885
1771
...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

4080
3926
6845
844
5716
5819
5790
89
5784
5145
6842
366
2973
976
3037
1497
3020
4226
4198
2135
469
5459
1525
2181
4428
1103
1547
4547
4061
985
784
4751
4662
4865
1201
4849
3823
3539
6352
2471
5036
1782
3549
2537
3228
5782
5142
3887
6789
6536
5245
1803
6482
4683
2670
2689
3877
905
3315
1665
5975
103
...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

3
4
10
6
7
5
9
1
8
2
11

result:

ok good plan

Test #64:

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

input:

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

output:

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

result:

ok good plan

Test #65:

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

input:

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

output:

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

result:

ok good plan

Test #66:

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

1
2
8
7
10
5
6
3
9
4

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

3
5
1
2
6
4

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed