QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#68858#5108. Prehistoric Programschenshi#WA 358ms23064kbC++14725b2022-12-21 12:07:292022-12-21 12:07:32

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-12-21 12:07:32]
  • 评测
  • 测评结果:WA
  • 用时:358ms
  • 内存:23064kb
  • [2022-12-21 12:07:29]
  • 提交

answer

#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
const int o=1e6+10;
int n,a[o],b[o],p[o],len,sm;char s[o*10];
inline bool cmp(int A,int B){
	if(b[A]==b[B]) return a[A]>a[B];
	if((a[A]>0)^(a[B]>0)) return a[A]>0;
	if(a[A]>0) return b[A]>b[B];
	return b[A]<b[B];
}
int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;p[i]=i,++i){
		scanf("%s",s+1);len=strlen(s+1);
		for(int j=1;j<=len;b[i]=min(b[i],a[i]),++j)
			if(s[j]=='(') ++a[i];
			else if(s[j]==')') --a[i];
	}
	sort(p+1,p+n+1,cmp);
	for(int i=1;i<=n;++i)
		if(sm+b[p[i]]<0){printf("impossible");return 0;}
		else sm+=a[p[i]];
	if(sm) printf("impossible");
	else for(int i=1;i<=n;++i) printf("%d\n",p[i]); 
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 18ms
memory: 4060kb

input:

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

output:

41248
4238
13809
27609
5338
2458
389
48374
6754
48749
18533
42979
14096
6986
5803
169
23456
32583
3405
31692
43508
38930
26695
26677
34539
9225
10427
46194
25061
35132
11398
46429
41740
21764
39743
30771
2253
24373
5699
31402
35039
45491
33777
23312
34110
39389
35743
6381
41639
41641
28794
23551
979...

result:

ok good plan

Test #2:

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

input:

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

output:

36
13
66
386
966
585
286
257
83
127
39
595
476
598
329
907
214
814
981
427
62
707
662
131
384
807
511
793
379
767
271
638
449
80
869
474
746
239
327
632
20
422
387
919
296
535
715
915
553
171
345
975
88
989
334
168
473
502
31
406
820
819
164
604
725
827
863
774
563
390
98
859
778
575
414
872
208
929...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
3
1

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
1
3
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

311
329
479
232
483
199
443
350
211
253
177
414
297
357
265
80
205
416
194
207
203
420
196
186
198
192
208
209
210
415
214
413
412
411
410
219
409
406
405
404
226
227
157
166
437
439
440
442
160
159
158
436
156
153
152
445
149
449
143
180
424
426
395
427
184
428
182
429
191
178
176
431
172
171
434
4...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

468
163
379
390
204
396
707
585
590
4
122
1
658
601
657
405
104
34
180
274
79
158
473
269
108
547
681
526
25
705
504
485
571
149
730
606
530
246
395
56
230
55
218
103
481
131
341
406
166
164
494
408
156
382
426
43
418
41
333
648
281
181
182
184
185
304
440
186
690
441
434
605
635
191
331
477
195
442...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 328ms
memory: 15324kb

input:

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

output:

149392
264227
387984
770337
898404
995820
83071
269214
349084
857929
897909
731069
174818
604894
385160
196234
765299
352796
760108
904916
134097
526593
708004
308325
748267
992894
309146
911588
501576
540367
592970
675083
489285
197429
900795
342091
160328
474263
619800
507757
475916
267140
610823
...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 65ms
memory: 12008kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 54ms
memory: 11248kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

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

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 61ms
memory: 12256kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 52ms
memory: 10328kb

input:

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

output:

2
1

result:

ok good plan

Test #32:

score: 0
Accepted
time: 33ms
memory: 9532kb

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 72ms
memory: 11652kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

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

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 173ms
memory: 13648kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

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

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: 201ms
memory: 23064kb

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: 358ms
memory: 14272kb

input:

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

output:

510441
164663
944202
483356
500584
889056
183559
637097
732016
496501
763948
163748
90286
679768
879218
590693
428626
629235
911154
924596
321244
67591
323909
970762
295142
261112
598737
480176
378339
475331
651410
766848
897141
130656
880821
850025
491924
451519
235797
354542
740159
947844
553153
4...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 322ms
memory: 14868kb

input:

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

output:

250826
568499
494698
675014
629151
425960
795023
985988
536620
106383
300744
926090
561779
463859
597972
575206
137311
689231
963161
333208
746420
427235
353729
930603
207485
388609
129338
116108
487205
905927
834142
470327
696104
123122
997127
770416
623824
209291
902316
271110
12900
192291
475514
...

result:

ok good plan

Test #40:

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

input:

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

output:

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

result:

ok good plan

Test #41:

score: -100
Wrong Answer
time: 53ms
memory: 4012kb

input:

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

output:

impossible

result:

wrong answer you didn't find a solution but jury did