QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#601741#5108. Prehistoric ProgramsAndycipationAC ✓144ms36224kbC++201.3kb2024-09-30 11:50:502024-09-30 11:50:50

Judging History

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

  • [2024-09-30 11:50:50]
  • 评测
  • 测评结果:AC
  • 用时:144ms
  • 内存:36224kb
  • [2024-09-30 11:50:50]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#ifdef _DEBUG
#include "debug.h"
#else
#define debug(...) 42
#endif

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  vector<long long> down(n), up(n);
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    int mn = 0;
    int sum = 0;
    for (char c : s) {
      int d = (c == '(' ? +1 : -1);
      sum += d;
      mn = min(mn, sum);
    }
    down[i] = -mn;
    up[i] = sum + down[i];
  }
  vector<int> order(n);
  iota(order.begin(), order.end(), 0);
  sort(order.begin(), order.end(), [&](int i, int j) {
    // return min(-down[i], -down[i] + up[i] - down[j]) > min(-down[j], -down[j] + up[j] - down[i]);
    // return max(down[i], down[i] - up[i] + down[j]) < max(down[j], down[j] - up[j] + down[i]);
    bool goodI = (up[i] >= down[i]);
    bool goodJ = (up[j] >= down[j]);
    if (goodI != goodJ) return goodI;
    if (goodI) return down[i] < down[j];
    return up[i] > up[j];
  });
  int at = 0;
  for (int i : order) {
    at -= down[i];
    if (at < 0) {
      cout << "impossible\n";
      return 0;
    }
    at += up[i];
  }
  if (at != 0) {
    cout << "impossible\n";
    return 0;
  }
  for (int i : order) {
    cout << i + 1 << '\n';
  }
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 7ms
memory: 4188kb

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

input:

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

output:

827
271
595
268
267
596
265
598
258
257
929
604
590
253
252
826
825
933
934
247
245
243
242
290
919
301
563
564
297
296
566
570
573
291
611
575
576
287
286
577
584
282
280
585
925
947
208
636
206
638
640
814
945
198
197
646
209
190
189
188
948
650
652
653
655
182
181
626
935
239
822
615
617
619
229
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

1
2
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

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

result:

ok good plan

Test #12:

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

input:

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

output:

10
37
38
17
36
34
22
23
43
32
24
25
27
6
5
4
3
28
31
29
14
13
46
42
9
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: 0ms
memory: 3784kb

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

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

result:

ok good plan

Test #16:

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

input:

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

output:

36
111
110
27
93
108
30
60
136
58
106
65
55
129
97
52
98
50
99
45
48
140
89
8
131
130
81
122
5
92
75
74
118
123
117
68
115
149
67
84
57
88
56
1
70
63
42
26
11
19
24
9
31
127
46
100
124
128
35
119
101
82
14
120
114
15
91
146
37
133
107
43
32
90
78
12
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: 0ms
memory: 3564kb

input:

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

output:

294
331
330
326
324
632
635
636
304
645
297
648
332
650
651
287
653
281
654
276
274
269
657
618
609
374
371
369
368
612
362
361
360
358
357
658
348
622
345
624
343
341
625
338
335
333
208
672
225
224
673
220
674
218
214
213
212
677
227
204
680
197
681
195
684
191
186
185
184
246
265
264
263
259
258
...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

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
14
98
95
94
5
6
7
92
9
87
11
12
86
15
16
85
84
19
21
22
80
76
100
81
75
3
56
89
77
78
79
23
20
82
83
18
17
13
10
88
24
90
91
8
93
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: 3516kb

input:

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

output:

79
33
85
36
37
38
83
41
42
82
45
46
80
48
49
35
78
52
53
54
55
56
77
58
59
60
75
73
65
69
9
14
95
31
96
18
19
97
21
98
22
4
1
8
26
88
28
7
29
6
2
76
15
93
99
92
66
74
72
71
94
81
91
90
89
84
100
87
86
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: 0ms
memory: 3804kb

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

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

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: 12ms
memory: 21252kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

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

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

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

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 14ms
memory: 16060kb

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 17ms
memory: 21336kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 47ms
memory: 22604kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 69ms
memory: 22648kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 94ms
memory: 22764kb

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: 96ms
memory: 36224kb

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: 141ms
memory: 22780kb

input:

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

output:

628371
628357
628360
628361
628362
628366
249235
628368
249232
249230
628370
249241
628372
628374
628379
249217
628384
628385
628387
249211
249210
249208
249252
249263
628332
628334
249260
249258
249257
249256
628341
249254
249253
628394
628346
628347
628348
628350
249246
628351
249244
628354
628355...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 144ms
memory: 22728kb

input:

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

output:

683984
478548
212277
212276
212275
683980
683981
212272
683982
478547
683977
349893
349894
683990
212264
683995
683997
212261
212260
684000
212289
683946
212299
683954
683955
212294
683956
683958
683960
683962
684001
683964
349888
212286
683967
683969
683970
212282
212280
684055
684039
684041
684043...

result:

ok good plan

Test #40:

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

input:

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

output:

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

result:

ok good plan

Test #41:

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

input:

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

output:

48
12
75
7
81
36
33
76
99
16
10
105
59
108
70
22
5
15
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: 18ms
memory: 4432kb

input:

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

output:

21944
36712
19008
5371
10477
34239
15869
47839
20163
23037
47838
36715
5361
5360
39428
58487
47835
58498
21943
47834
58501
53268
58502
36717
21942
53266
34228
5344
58507
26521
26531
28961
45742
20150
28962
53299
5410
44503
41381
53295
40789
5404
58456
43334
58463
5340
17840
34249
28972
58469
43331
1...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 111ms
memory: 17704kb

input:

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

output:

355518
164496
355529
164500
355528
666591
164504
164505
355524
355523
355521
164509
666587
355520
579473
579470
164514
164515
164516
355517
164518
579475
579477
164521
164522
355513
355512
355509
355508
666598
164463
355557
579455
579459
164468
579461
164470
666601
164472
666600
164475
164476
666599...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

18
36
30
29
38
27
25
24
40
19
17
14
52
7
44
12
13
5
22
32
41
47
37
42
11
15
4
21
26
31
33
1
49
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: 0ms
memory: 3592kb

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: 0ms
memory: 3524kb

input:

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

output:

21
62
23
24
6
50
45
44
43
79
36
83
33
15
42
77
34
90
56
60
63
19
18
84
4
70
39
12
59
53
52
31
30
78
27
61
37
54
40
9
86
87
22
76
7
14
57
74
49
81
8
75
16
80
51
73
35
69
89
72
88
66
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: 0ms
memory: 3528kb

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

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:

1759
1135
2623
1133
1132
2624
2626
1129
1128
1127
2627
2629
2630
1998
1136
2636
2637
1760
1118
2640
1116
2648
2649
2651
1111
1763
2655
1999
2606
1160
2002
1158
1157
1753
2610
1154
1153
2611
2001
2615
1107
1148
1147
1146
1145
2617
1756
1142
2619
2620
2621
1757
1137
2709
2694
2695
2696
1076
1075
2697
...

result:

ok good plan

Test #54:

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

input:

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

output:

3269
6331
3280
6333
6334
6336
6339
3271
3270
6330
3268
6340
3266
6341
6342
3261
3260
3259
3295
3304
6321
6322
3301
3300
6323
3297
3296
3256
3294
3293
3291
3290
3287
3285
3284
6329
3219
6360
3228
3227
6362
3223
3222
3221
6364
6359
3217
6366
3215
6367
6368
3212
6370
6371
6351
3254
3253
3251
3250
3249
...

result:

ok good plan

Test #55:

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

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

input:

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

output:

1391
1406
1405
1404
2841
1402
2844
1400
1399
1398
2845
2847
1395
1394
1393
1392
2838
2848
1389
2849
1387
2854
2855
2856
1383
1382
1381
2859
1379
1377
2862
2864
1426
2798
2800
2804
2805
1439
1438
1437
2806
1434
2810
2811
2812
1429
1428
2815
2865
2818
1424
2819
2821
2824
2826
2828
2829
2831
1414
1412
...

result:

ok good plan

Test #57:

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

input:

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

output:

4456
4466
2000
4463
3410
4461
4460
2007
4459
3876
3408
3412
2012
3407
3406
3877
3404
2017
2018
4450
2022
2023
3414
4480
4478
1969
1970
1971
1972
1973
1975
4477
1977
4449
1979
1980
1981
4475
4474
1986
4473
3875
4471
4468
2065
2053
2054
2055
4437
4436
3396
2060
2061
4433
2064
2052
3881
4431
2069
4430
...

result:

ok good plan

Test #58:

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

input:

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

output:

1150
1165
3003
1163
1161
3005
3006
3007
2682
1156
1155
2007
2008
1152
2004
3011
2011
3013
1145
1143
3015
1141
1140
2014
1138
3016
1136
1179
1992
2685
1994
1188
1187
2684
1185
2995
2996
1182
1181
2997
1135
1997
1177
2998
1175
2999
1173
1172
1998
2000
2001
2003
1167
1094
1107
1106
1105
1104
3029
1102
...

result:

ok good plan

Test #59:

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

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: 0ms
memory: 3540kb

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

5628
5645
5644
2894
5642
5640
2899
5637
5636
2905
2911
2912
2913
2914
5630
2916
2891
2919
2920
2921
2922
2923
2925
2926
2927
2931
5623
2935
5620
2939
2941
2942
5652
5661
2856
2857
5659
5656
2863
2864
2865
5655
2867
2868
2869
2870
5654
5653
5617
2874
2875
2876
5651
2878
2879
2880
2881
2882
5650
5649
...

result:

ok good plan

Test #62:

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

input:

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

output:

18
35
34
33
31
30
29
28
40
26
25
24
43
44
20
45
50
60
3
59
57
6
53
52
51
17
11
12
13
46
16
23
14
32
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: 3612kb

input:

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

output:

3
4
5
6
9
7
10
8
1
2
11

result:

ok good plan

Test #64:

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

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
1
55
68
86
83
81
58
73
59
63
75
22
2
3
4
6
7
8
10
12
13
15
16
17
19
20
21
53
23
24
25
26
28
29
32
33
35
36
40
43
45
46
50

result:

ok good plan

Test #65:

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

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

1
3
5
2
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed