QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356461#5108. Prehistoric ProgramsTWTP_TCTF#AC ✓188ms28568kbC++141.8kb2024-03-17 20:25:002024-03-17 20:25:01

Judging History

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

  • [2024-03-17 20:25:01]
  • 评测
  • 测评结果:AC
  • 用时:188ms
  • 内存:28568kb
  • [2024-03-17 20:25:00]
  • 提交

answer

#include<iostream>
#include <bits/stdc++.h>

#define ld long double
#define ll long long
#define IO ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
using namespace std;
const int N = 1e4 + 9, MOD = 998244353;

//
// + +, - - , - +
//(((  , )))  , )))(((

//  ))))(((( , (((((( , ))))))
pair<int, int> calc(string &s) {
    int cnt = 0;
    int mn = 1e9;
    for (auto i: s) {
        if (i == '(') {
            cnt++;
        } else {
            cnt--;
        }
        mn = min(mn, cnt);
    }
    return {mn, cnt}; //

} // )))))(( | cnt = 3 , mn = 2      )))))((
//x =  |  cnt = -3 , mn = -5   |  cnt = -1 , mn = -3  //
// )))) , )))(((( -3 , 1      // )(((  ))))))) (((((((((((      // 7,5 // 5,5
bool sortt(pair<int, pair<int, int> > &x, pair<int, pair<int, int> > &y) {
    pair<int, int> a = x.second, b = y.second;

    if (a.second >= 0 && b.second >= 0) {
        return a.first > b.first;
    }
    if (a.second < 0 && b.second < 0) {
        return a.second - a.first > b.second - b.first;
    }

    return a.second > b.second;
}

// (((((()))))(()))(
void doWork() {
    int n;
    cin >> n;
    vector<pair<int, pair<int, int> > > v;

    for (int i = 1; i <= n; i++) {
        string s;
        cin >> s;
        v.push_back({i, calc(s)});
    }
    sort(v.begin(), v.end(), sortt);
    ll total = 0;
    for (auto i: v) {
        if (total + i.second.first < 0) {
            cout << "impossible";
            return;
        }
        total += i.second.second;
    }
    if (total != 0) {
        cout << "impossible";
    } else {
        for (auto i: v)cout << i.first << "\n";
    }
}

int main() {

    IO
    int t = 1;
//    cin >> t;
    for (int i = 1; i <= t; i++) {
        //  cout << "Case #" << i << ": ";
        doWork();
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 9ms
memory: 4116kb

input:

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

output:

25955
25989
25988
25985
25983
25980
25978
25977
25974
25968
25960
25958
25957
25956
25990
25951
25950
25946
25944
25943
25941
25940
25937
25935
25931
25925
25917
25915
26017
26063
26051
26047
26045
26042
26039
26038
26036
26027
26025
26024
26022
26021
25914
26016
26012
26010
26009
26007
26005
26001
...

result:

ok good plan

Test #2:

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

input:

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

output:

243
604
253
252
826
825
933
934
247
245
929
242
611
935
822
615
229
228
820
819
585
570
573
291
576
287
577
584
282
280
223
925
590
271
268
267
265
598
258
257
662
948
650
652
655
182
178
177
811
659
188
171
168
663
166
666
164
667
162
668
208
628
632
217
216
215
213
212
943
209
566
636
640
814
945
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

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

result:

ok good plan

Test #12:

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

input:

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

output:

10
37
38
17
34
22
23
43
32
24
25
5
28
27
6
36
4
3
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: 3804kb

input:

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

output:

2
47
46
41
40
28
26
18
16
13
11
33
15
5
8
4
37
19
42
44
3
10
29
21
6
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: 3856kb

input:

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

output:

84
37
38
35
40
92
32
140
73
28
141
24
49
143
52
111
100
15
14
4
148
12
105
6
60
104
149
7
94
98
103
130
106
48
120
53
69
87
136
79
11
17
142
20
51
5
62
61
10
16
96
117
91
23
89
70
27
93
129
137
135
133
147
102
77
29
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: 3636kb

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

36
115
67
92
111
108
30
60
136
106
84
55
129
97
52
99
45
48
140
117
81
8
131
123
75
74
149
118
27
93
89
110
65
58
5
50
130
98
68
122
42
56
57
88
1
63
70
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: 1ms
memory: 3628kb

input:

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

output:

172
369
157
158
159
160
368
162
612
164
362
166
169
690
358
155
357
618
175
176
348
622
345
180
181
182
624
184
185
186
138
601
121
122
401
397
395
392
131
390
387
699
698
136
697
343
605
385
141
384
383
606
378
148
1
150
609
152
374
371
669
220
281
673
654
225
672
227
228
229
230
231
274
657
265
67...

result:

ok good plan

Test #18:

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

input:

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

output:

66
32
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
37
42
95
25
73
78
77
76
80
75
16
83
8
85
7
5
89
90
92
93
3
96
97
98
99
2
52
30
33
34
35
36
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: 3776kb

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

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
16
6
7
92
9
87
11
12
86
5
15
94
84
19
95
21
22
80
76
98
14
85
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: 1ms
memory: 3540kb

input:

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

output:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

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

input:

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

output:

528195
528176
528177
528180
528181
528183
528187
528188
528189
528171
528196
528201
528204
528206
528208
528211
528212
528213
528149
528125
528127
528129
528133
528135
528137
528139
528146
528215
528151
528152
528154
528155
528157
528159
528160
528169
528293
528269
528270
528271
528272
528276
528279...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 10ms
memory: 19616kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

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

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

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

input:

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

output:

impossible

result:

ok impossible

Test #30:

score: 0
Accepted
time: 13ms
memory: 19604kb

input:

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

output:

impossible

result:

ok impossible

Test #31:

score: 0
Accepted
time: 10ms
memory: 14932kb

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 9ms
memory: 19788kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 63ms
memory: 15372kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 66ms
memory: 15552kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 120ms
memory: 15416kb

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: 112ms
memory: 28568kb

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: 188ms
memory: 15492kb

input:

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

output:

218824
673999
673994
218791
673992
673991
673990
673985
673979
673978
673975
673972
218812
218814
218815
673957
674001
673949
673946
673942
218831
673937
673936
673935
218838
218841
218845
218846
218847
673921
673920
218853
218747
674105
674101
218721
674096
218724
218725
674093
218730
674085
674084...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 187ms
memory: 15592kb

input:

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

output:

469346
187051
721754
469340
356016
469342
187057
721748
469343
187061
721746
187064
187067
721743
469345
187050
469349
721726
469351
721716
721715
469355
187083
469357
187088
187090
721695
187097
721690
721817
469318
186999
721833
187002
187005
187006
721828
721827
721826
187011
721822
187015
187016...

result:

ok good plan

Test #40:

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

input:

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

output:

163
542
367
108
358
253
537
236
469
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: 43ms
memory: 4560kb

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: 48ms
memory: 4080kb

input:

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

output:

24716
29394
49549
59399
33843
20356
49552
41515
29401
26324
4560
52778
33833
18913
59428
29408
59433
10914
47536
26319
4575
40754
43131
4589
23811
4582
44603
52801
33850
4576
4514
20351
4571
33849
16120
45353
59389
4564
23063
29444
52741
29438
10948
59502
4456
52739
59521
59522
33803
16153
43093
444...

result:

ok good plan

Test #43:

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

input:

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

output:

143039
143020
375812
570244
375800
570246
570248
375788
676456
143035
375784
143019
143041
143042
375779
676451
143046
676450
375777
143053
143054
676473
375847
142985
142986
375841
676478
142996
142997
375827
375825
143055
143007
570233
676469
375818
143013
570236
143015
570237
570239
570292
143114...

result:

ok good plan

Test #44:

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

input:

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

output:

23
7
2
25
17
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: 3584kb

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

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

input:

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

output:

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

input:

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

output:

21
5
25
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: 3552kb

input:

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

output:

24
50
45
79
36
15
21
62
23
6
44
43
83
33
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: 1ms
memory: 3648kb

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

input:

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

output:

23
27
11
28
18
17
1
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: 3608kb

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

input:

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

output:

2717
2699
1072
1071
2702
1069
1767
2709
2711
1064
1063
1061
2697
2718
2719
2720
2722
1052
1051
1989
2730
1047
1046
1044
1087
2670
2677
1097
2678
2680
2685
2686
2687
1090
1089
2691
1043
1084
2693
1082
1081
1080
2694
2695
2696
1076
1075
2781
1013
1012
2771
2773
1009
1008
1007
2774
2776
2779
2780
2769
...

result:

ok good plan

Test #54:

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

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

input:

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

output:

1099
1132
1126
1119
1117
1112
1108
1106
1105
1141
1095
1094
1085
1076
1072
1069
1068
1067
1143
1145
1149
1156
1157
1159
1162
1163
1167
1172
1174
1176
1177
1179
1182
1002
928
930
933
935
945
966
967
970
972
974
984
987
989
998
1000
1187
1007
1010
1017
1024
1035
1037
1039
1044
1047
1048
1050
1055
1057...

result:

ok good plan

Test #56:

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

input:

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

output:

1320
1340
2894
2896
2904
1332
2906
1329
1328
2908
2911
2913
2914
2915
1321
2891
2918
2920
1316
2921
2922
1313
1311
1310
1309
2923
1307
2925
2930
2877
2864
2865
2867
2868
1370
1369
1368
2869
1365
2871
1363
1362
2872
1359
1301
1356
1354
2879
1352
1351
2880
1349
2881
2882
2887
1344
2888
2890
1234
2974
...

result:

ok good plan

Test #57:

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

input:

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

output:

1908
1893
1894
3427
4512
4511
4510
1902
4509
3426
4518
1911
4505
4504
3424
3423
1918
3421
1920
1921
4527
1862
1863
1864
1865
4534
4533
1870
4530
4529
4498
3872
3430
4522
1882
3873
1884
1885
3428
4478
4485
1954
1956
1957
4483
4482
3415
1963
4480
1950
1969
1970
1971
1972
1975
3414
1979
1980
1981
1938
...

result:

ok good plan

Test #58:

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

input:

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

output:

1085
3031
1097
2025
1095
1093
2674
1090
1089
1088
1087
1086
2024
3034
1082
3036
3038
1077
2029
2031
1072
1071
2671
3042
1117
1130
1129
3018
2015
1126
1124
2017
1122
3021
3022
1118
1067
1114
3025
3026
2676
1109
1107
1106
1105
1104
3029
2022
2049
1037
1036
1035
1033
1032
1031
3057
2046
3058
3059
2047
...

result:

ok good plan

Test #59:

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

input:

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

output:

1014
2440
2447
1025
1024
2451
1021
1020
1018
1017
1016
1015
2436
2462
2465
2469
1010
2471
2472
2473
2477
1004
2478
1042
1053
2400
2401
2402
2403
2404
2405
2407
1045
2412
2413
1002
1041
2417
2419
1038
2424
2428
2430
1034
2431
1031
2553
2528
2534
2537
2542
2547
968
967
2549
965
964
2551
2524
2555
959
...

result:

ok good plan

Test #60:

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

input:

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

output:

22
97
73
68
69
98
102
105
106
110
95
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: 3908kb

input:

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

output:

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

result:

ok good plan

Test #62:

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

input:

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

output:

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

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

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

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

1
2
7
8
10
3
4
5
6
9

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

3
5
1
2
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed