QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#189224#5108. Prehistoric Programsbulijiojiodibuliduo#AC ✓196ms24312kbC++171.5kb2023-09-27 01:35:012023-09-27 01:35:02

Judging History

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

  • [2023-09-27 01:35:02]
  • 评测
  • 测评结果:AC
  • 用时:196ms
  • 内存:24312kb
  • [2023-09-27 01:35:01]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=n-1;i>=a;i--)
#define pb push_back
#define eb emplace_back
#define mp make_pair
#define all(x) (x).begin(),(x).end()
#define fi first
#define se second
#define SZ(x) ((int)(x).size())
typedef vector<int> VI;
typedef basic_string<int> BI;
typedef long long ll;
typedef pair<int,int> PII;
typedef double db;
mt19937 mrand(random_device{}()); 
const ll mod=1000000007;
int rnd(int x) { return mrand() % x;}
ll powmod(ll a,ll b) {ll res=1;a%=mod; assert(b>=0); for(;b;b>>=1){if(b&1)res=res*a%mod;a=a*a%mod;}return res;}
ll gcd(ll a,ll b) { return b?gcd(b,a%b):a;}
// head

const int N=10100000;
int n;
char s[N];
array<int,3> p[N/10];
int main() {
	scanf("%d",&n);
	rep(i,0,n) {
		scanf("%s",s);
		int m=strlen(s);		
		int r=0,l=0;
		rep(i,0,m) {
			if (s[i]=='(') l++;
			else if (l>0) l--;
			else r++;
		}
		//printf("? %d %d\n",r,l);
		p[i]={r,l,i};
	}
	sort(p,p+n,[&](array<int,3> a,array<int,3> b){
		int ta=a[1]-a[0],tb=b[1]-b[0];
		int ua=ta==0?0:(ta>0?1:-1);
		int ub=tb==0?0:(tb>0?1:-1);
		if (ua!=ub) return ua>ub;
		if (ua==0) return false;
		if (ua==1) {
			return a[0]<b[0];
		} else {
			return a[1]>b[1];
		}
	});
	int t=0;
	rep(i,0,n) {
		t-=p[i][0];
		if (t<0) {
			puts("impossible");
			return 0;
		}
		t+=p[i][1];
	}
	if (t!=0) {
		puts("impossible");
		return 0;
	}
	rep(i,0,n) printf("%d\n",p[i][2]+1);
}

详细

Test #1:

score: 100
Accepted
time: 6ms
memory: 4248kb

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: 2ms
memory: 3828kb

input:

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

output:

819
280
822
925
615
271
619
268
267
265
820
611
258
257
929
253
252
933
934
247
628
245
598
316
913
585
313
915
309
590
919
301
595
243
296
604
827
291
290
826
287
286
825
282
188
652
206
655
945
198
811
659
947
190
189
208
948
662
663
666
182
181
667
179
178
177
223
242
935
239
632
636
638
640
229
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

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

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

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
5
41
115
103
117
48
96
53
55
85
129
130
136
137
20
21
33
8
121
126
71
...

result:

ok good plan

Test #15:

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

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
8
26
5
19
14
10
102
107
75
16
84
80
112
23
55
113
117
29
145
39
74
82
34
63
53
88
85
144
21
140
41
7
62
45
18
50
76
15
13
42
90
4
136
66
114
40
111
97
96
79
116
81
139
20
108
78
130
137
125
3
115
...

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

440
589
231
230
229
228
227
672
225
224
437
673
441
220
674
218
442
588
214
213
246
661
255
427
593
429
592
250
663
664
212
665
432
243
434
590
668
238
669
164
182
180
176
175
172
690
169
166
578
184
163
162
160
159
158
157
156
155
195
587
677
208
446
204
450
680
585
681
426
684
191
455
584
581
461
...

result:

ok good plan

Test #18:

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

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

49
33
85
35
36
37
38
83
41
42
82
45
46
80
48
2
79
78
52
53
54
55
56
77
58
59
60
75
73
65
22
95
96
31
97
98
18
19
9
8
21
7
6
26
4
28
29
1
15
99
76
69
93
14
88
92
66
89
86
71
72
100
87
74
84
90
91
81
94
34
3
5
10
11
12
13
16
17
20
23
24
25
27
30
32
70
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: 3528kb

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 169ms
memory: 15516kb

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: 23ms
memory: 13300kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 29ms
memory: 13336kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

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

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

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

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

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

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 70ms
memory: 15404kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 83ms
memory: 15348kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 135ms
memory: 15532kb

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

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: 196ms
memory: 15480kb

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: 195ms
memory: 15408kb

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: 65ms
memory: 3856kb

input:

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

output:

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

result:

ok good plan

Test #41:

score: 0
Accepted
time: 56ms
memory: 4156kb

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
70
4
88
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: 71ms
memory: 4544kb

input:

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

output:

18868
45296
18833
18834
18835
45294
45293
45288
45285
58176
45280
18864
5830
45266
58191
45298
18872
45258
45255
45254
5821
5819
45236
45235
45233
18896
5811
45230
18901
45226
18773
45378
45369
18738
5890
58125
18742
18745
58132
45360
18758
45353
45344
18770
58140
18909
18779
18783
58144
58147
18785...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 165ms
memory: 12396kb

input:

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

output:

140120
329701
329699
140107
140108
591188
329693
677839
677836
329690
329686
329683
140118
329703
140121
329680
677832
591195
140125
140127
140128
329675
677830
329669
140132
591170
329739
140079
329736
140081
140082
677851
329735
329734
140086
591169
329732
329663
329725
329724
329721
140093
329720...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

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

input:

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

output:

2557
1160
2535
1158
1157
2538
2542
1153
2547
2552
1147
1146
1145
1162
1142
2559
2561
2563
1137
1136
2565
1133
1132
1129
1128
1180
2509
2512
1192
2514
1190
2515
1188
2516
1186
1185
1184
1182
1127
1179
1178
1175
1174
2528
1170
1169
2529
1166
2531
2532
1075
1089
2617
1087
2619
1084
2620
1082
1081
1080
...

result:

ok good plan

Test #54:

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

input:

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

output:

3228
3242
3241
3240
3239
6355
3233
6359
6360
3243
3227
6362
3223
3222
3221
6364
3219
3217
3253
3266
6341
6342
3261
3260
3259
3256
3254
6366
3251
3250
3249
3248
6349
3245
6351
3181
3192
3190
6380
3188
6381
3186
6383
3182
6378
3180
3176
3175
6388
3169
3166
3165
3204
3215
6367
6368
3212
6370
6371
3207
...

result:

ok good plan

Test #55:

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

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

input:

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

output:

1310
2833
2838
2841
1321
1320
2844
2845
2847
1316
2848
2849
1313
1312
1311
2831
1309
2854
1307
2856
2859
1301
1299
2864
2865
2867
2868
1294
2869
2871
1344
2791
2794
1359
2798
1356
1354
2800
1352
1351
2804
1349
2805
2806
2810
2872
2812
1340
2815
2818
2819
2821
2824
1332
2826
2828
1329
1328
2829
2925
...

result:

ok good plan

Test #57:

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

input:

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

output:

1933
3421
1920
1921
4498
4496
1927
1928
3874
4492
1918
1934
3418
1936
1938
4489
4488
3417
4486
1944
4510
1884
1885
3428
4518
1893
1894
3427
4512
4511
1945
1902
4509
3426
1908
1911
4505
4504
3424
3423
2000
1979
1980
1981
4475
4474
1986
4468
3412
4466
3414
4463
3410
4460
4459
3876
3408
4456
2012
3407
...

result:

ok good plan

Test #58:

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

input:

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

output:

1965
1959
1960
1961
1072
1071
1962
1963
3042
1067
1066
3044
1958
3046
1966
1967
1059
1058
1057
1969
1972
1974
3051
2688
1089
1946
1949
3031
1097
1950
1095
1951
1093
2698
2697
1090
1977
1088
1087
1086
1085
3034
1954
1082
3036
1956
3038
1077
1003
1015
3066
3068
1011
1010
1009
1008
1992
1006
2685
1004
...

result:

ok good plan

Test #59:

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

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

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
61
80
67
120
119
43
42
13
24
45
90
107
71
34
75
100
23
83
86
96
40
44
88
41
114
54
19
53
60
59
17
32
21
104
85
8
99
26
49
1
37
81
57
30
101
12
20
126
46
52
58
...

result:

ok good plan

Test #61:

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

input:

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

output:

5636
2882
5650
5649
2885
2888
5646
2890
2891
5645
5644
2894
5642
5640
2899
5637
2881
2905
2911
2912
2913
2914
5630
2916
5628
2919
2920
2921
2922
2923
2925
2926
5655
5665
2848
5664
2851
5662
2853
2854
5661
2856
2857
5659
5656
2863
2864
2865
2927
2867
2868
2869
2870
5654
5653
5652
2874
2875
2876
5651
...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

3
4
5
6
7
10
9
8
1
2
11

result:

ok good plan

Test #64:

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

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
74
11
79
80
14
77
76
9
18
82
5
72
71
84
85
70
69
78
65
59
68
58
75
81
63
83
73
86
55
1
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: 1ms
memory: 3820kb

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

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

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

3
5
1
2
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed