QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#355136#5108. Prehistoric Programsucup-team052#AC ✓234ms67092kbC++231.1kb2024-03-16 13:46:172024-03-16 13:46:19

Judging History

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

  • [2024-03-16 13:46:19]
  • 评测
  • 测评结果:AC
  • 用时:234ms
  • 内存:67092kb
  • [2024-03-16 13:46:17]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define N 1000005
string s[N];
int mn[N],sum[N],id[N],vis[N];
int n;
signed main()
{
#ifdef xay5421
	freopen("a.in","r",stdin);
#endif
	ios::sync_with_stdio(0),cin.tie(0);
	cin>>n;
	for(int i=1;i<=n;i++) cin>>s[i];
	for(int i=1;i<=n;i++)
	{
		int l=s[i].length();
		int cur=0;
		for(int j=0;j<l;j++)
		{
			if(s[i][j]=='(') cur++;
			else cur--;
			mn[i]=min(mn[i],cur);
		}
		sum[i]=cur;
		id[i]=i;
	}
// 	for(int i=1;i<=n;i++) printf("%d %d\n",mn[i],sum[i]);
	sort(id+1,id+n+1,[&](int x,int y){return mn[x]>mn[y];});
	vector<int> ans;
	int cur=0;
	for(int i=1;i<=n;i++)
	{
		int u=id[i];
		if(mn[u]+cur>=0&&sum[u]>=0)
		{
			vis[u]=1,ans.push_back(u);
			cur+=sum[u];
		}
	}
	sort(id+1,id+n+1,[&](int x,int y){return sum[x]-mn[x]>sum[y]-mn[y];});
	for(int i=1;i<=n;i++)
	{
		int u=id[i];
		if(!vis[u]&&mn[u]+cur>=0)
		{
			cur+=sum[u];
			ans.push_back(u);
			vis[u]=1;
		}
	}
	if((int)ans.size()!=n||cur!=0) printf("impossible\n");
	else
	{
		for(int i:ans) printf("%d\n",i);
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 12ms
memory: 38340kb

input:

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

output:

26700
26740
26738
26737
26729
26727
26724
26723
26716
26715
26714
26713
26711
26709
26703
26744
26698
26696
26695
26693
26692
26689
26685
26682
26679
26677
26674
26672
26671
26670
26779
26819
26817
26815
26813
26810
26809
26806
26803
26802
26800
26792
26787
26784
26783
26668
26778
26777
26776
26773
...

result:

ok good plan

Test #2:

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

input:

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

output:

715
296
687
689
291
290
287
286
282
280
707
711
297
271
719
268
267
265
725
731
732
738
258
316
650
652
329
653
327
655
324
659
662
663
666
257
667
668
313
673
309
680
681
301
685
686
790
779
217
216
215
214
213
212
209
208
206
788
778
198
197
793
798
799
190
189
188
801
803
757
253
252
746
747
748
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

score: 0
Accepted
time: 5ms
memory: 36172kb

input:

3
()
(
)

output:

1
2
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

194
204
203
404
405
406
199
198
196
205
409
192
191
410
411
412
413
186
399
228
227
226
392
393
395
219
398
414
214
401
211
210
209
208
207
149
160
159
158
157
156
431
153
152
429
434
435
436
437
438
143
439
141
420
184
415
182
416
180
178
177
176
388
172
171
424
166
426
427
428
353
304
345
348
349
...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

228
246
243
541
238
547
549
231
230
229
530
227
554
225
224
555
556
220
218
563
512
500
276
502
274
504
269
265
264
263
214
516
518
259
258
522
255
526
252
250
594
186
185
184
591
182
181
180
592
593
590
176
175
172
169
601
166
164
163
162
574
213
212
569
208
570
571
572
204
573
281
197
581
195
584
...

result:

ok good plan

Test #18:

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

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
28
10
9
11
22
6
20
19
4
27
18
17
29
31
12
95
42
25
24
49
36
47
26
45
7
41
40
39
30
1
52
23
55
56
58
21
64
15
14
13
54
63
89
8
76
75
77
78
73
72
71
80
83
16
85
5
35
90
92
93
3
96
97
98
99
2
69
33
34

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

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

input:

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

output:

541083
541063
541066
541070
541071
541072
541073
541075
541077
541082
541062
541084
541085
541087
541088
541093
541094
541097
541104
541108
541046
541031
541032
541035
541038
541039
541041
541042
541044
541045
541109
541051
541052
541053
541054
541055
541057
541058
541060
541162
541148
541150
541153...

result:

ok good plan

Test #26:

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

input:

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

output:

impossible

result:

ok impossible

Test #27:

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

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

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

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

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

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

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

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 53ms
memory: 54148kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 57ms
memory: 46700kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 109ms
memory: 54312kb

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: 111ms
memory: 67092kb

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: 231ms
memory: 64192kb

input:

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

output:

666770
666751
666753
269783
666756
666761
666764
269776
269775
666767
666768
269771
666749
269768
269766
666774
666775
269763
269761
269760
269758
666779
269755
269800
666719
269811
666724
666728
269808
666730
269805
666732
666735
269801
666783
269798
269797
269796
666739
666740
666741
269792
269791...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 234ms
memory: 64200kb

input:

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

output:

748429
748421
204482
204481
204480
748423
204478
382165
528819
528818
204484
318078
204472
345736
748437
204469
204468
748441
204466
204493
748406
204501
318077
748408
204498
204497
748410
748414
528820
748443
204492
204491
748416
204489
204488
748417
204486
748419
748475
607857
204445
382178
748469...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 49ms
memory: 46404kb

input:

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

output:

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

result:

ok good plan

Test #41:

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

input:

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

output:

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

result:

ok good plan

Test #42:

score: 0
Accepted
time: 58ms
memory: 47380kb

input:

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

output:

39287
17711
55787
44772
27054
55782
17709
55779
5606
28894
5604
60016
28896
34705
27050
39290
39286
17703
55768
34710
27048
27047
17697
60028
60029
31838
5582
60030
60031
11617
31853
51515
55805
48725
11562
44755
55802
28881
31856
48721
34676
59988
34677
11571
34680
5578
17724
21598
41306
48708
6000...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 192ms
memory: 62392kb

input:

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

output:

273565
273587
273585
273576
273573
629236
629237
273570
629239
629240
629230
273564
629243
273558
273555
629246
273552
273548
273547
273623
273638
629207
273635
629209
273630
273629
273627
273624
273544
273620
273617
273612
273608
273607
629221
273592
629223
629288
629272
273485
273476
629282
273471...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

input:

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

output:

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

result:

ok good plan

Test #53:

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

input:

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

output:

2824
1409
1408
1407
2806
2809
1401
2814
1399
2815
1394
2820
2821
2822
1389
2805
1386
1384
1383
1382
2828
2831
1378
1377
1376
1375
2833
1371
2836
2837
1429
1447
2784
2786
1442
1441
2789
1439
2790
2791
1436
1433
2795
2796
1430
1365
2797
1427
1426
1425
2798
1423
1419
1418
1416
1415
1414
1413
1412
1300
...

result:

ok good plan

Test #54:

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

input:

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

output:

3206
6248
3219
3217
3215
6252
3212
6256
3207
3221
3204
3203
3202
6258
6259
3199
6260
3197
6238
3245
3243
3242
3241
3240
3239
6236
6237
3196
3233
3228
3227
6245
6246
3223
3222
3165
6271
3173
6273
3170
3169
6274
6275
3166
3175
3164
3163
3162
3161
3160
3159
6276
3157
6266
3195
3192
6263
3190
6264
3188
...

result:

ok good plan

Test #55:

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

input:

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

output:

1222
1251
1247
1246
1244
1243
1239
1238
1236
1233
1226
1253
1220
1217
1215
1211
1202
1201
1200
1199
1198
1281
1302
1301
1300
1299
1298
1297
1291
1288
1286
1283
1187
1277
1276
1273
1271
1269
1268
1265
1259
1257
1119
1146
1145
1143
1141
1136
1134
1132
1127
1126
1120
1149
1118
1117
1112
1108
1107
1106
...

result:

ok good plan

Test #56:

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

input:

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

output:

1623
1611
3196
1615
1616
1617
1618
3192
1622
1608
1627
3187
1630
3186
1632
1634
3184
3183
1597
3213
1588
1589
1590
3211
1594
1595
1596
1638
3208
1599
3205
3203
3202
3201
3200
3166
1659
3169
1663
3168
1665
1666
1667
1669
1658
1671
3164
1673
3163
3158
1678
3156
3155
3175
1639
3181
3178
1644
1645
1646
...

result:

ok good plan

Test #57:

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

input:

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

output:

2064
2053
2054
2055
4083
4082
4081
4080
2060
2061
4079
4078
2052
2065
4077
4076
2069
2072
2075
2076
4069
4063
2082
4092
2025
2026
4098
2028
2029
2030
4096
4094
2034
2035
2083
2038
2039
4091
2042
2043
2044
4088
2046
4087
2048
2128
2116
2118
2119
4042
4041
2122
4040
4039
2126
4037
2113
4036
2130
2131
...

result:

ok good plan

Test #58:

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

input:

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

output:

1767
1112
1919
1920
1109
2335
1107
1106
1105
1104
2333
1102
1923
2811
1099
2331
1097
1926
1095
1094
1093
1092
2822
1090
1089
1088
1126
1138
2801
1136
1135
1134
2802
1132
1131
1130
1129
2803
1685
1087
2337
1124
2806
1122
1768
2808
1119
1118
1117
2809
2810
1114
2850
1937
1059
1058
1057
2842
2843
1938
...

result:

ok good plan

Test #59:

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

input:

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

output:

2172
2161
2162
2163
2166
2167
2168
2169
2170
2171
2159
2173
2175
2176
2178
2180
2182
2186
2188
2189
2149
2126
2127
2128
2130
2133
2135
2142
2143
2145
2190
2150
2151
2152
2153
2154
2155
2156
2158
2244
2230
2231
2233
2237
2238
2239
2240
2242
2243
2229
2253
2257
2260
2262
2263
2266
2267
2268
2208
2191
...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

5603
2882
5617
2885
5615
2888
2890
2891
2894
5610
5608
5607
2899
5606
5605
5604
2881
2905
5598
5597
2911
2912
2913
2914
5596
2916
5595
2919
2920
2921
2922
2923
2863
2839
2840
2841
2842
5637
5636
2846
2848
2851
5630
2853
2854
2856
2857
5628
5593
2864
2865
5623
2867
2868
2869
2870
5620
2874
2875
2876
...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

3
4
5
6
9
7
10
8
1
2
11

result:

ok good plan

Test #64:

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

input:

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

output:

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

result:

ok good plan

Test #65:

score: 0
Accepted
time: 5ms
memory: 34960kb

input:

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

output:

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

result:

ok good plan

Test #66:

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

1
2
7
8
10
3
5
6
9
4

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

1
3
5
2
6
4

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed