QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#89855#5108. Prehistoric Programs_skb_#AC ✓471ms95100kbC++141.9kb2023-03-21 17:00:082023-03-21 17:00:10

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-21 17:00:10]
  • 评测
  • 测评结果:AC
  • 用时:471ms
  • 内存:95100kb
  • [2023-03-21 17:00:08]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);

    int n; cin >> n;
    vector <string> a(n);
    vector <pair <pair <int, int>, int>> aa(n);
    auto get_p = [&](string &s) {
        stack <char> st;
        for (int i = 0; i < (int) s.size(); ++i) {
            if (st.empty()) st.push(s[i]);
            else if (st.top() == '(' and s[i] == ')') st.pop();
            else st.push(s[i]);
        }
        int o = 0, c = 0;
        while (!st.empty()) {
            if (st.top() == '(') o++;
            else c++;
            st.pop();
        }    
        return make_pair(o, c);
    };
    vector <pair <pair <int, int>, int>> ax, ay, axyp, axyn;
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
        aa[i] = {get_p(a[i]), i};
        if (aa[i].first.second == 0) ax.push_back(aa[i]);
        else if (aa[i].first.first == 0) ay.push_back(aa[i]);
        else if (aa[i].first.first - aa[i].first.second <= 0) axyn.push_back(aa[i]);
        else if (aa[i].first.first - aa[i].first.second > 0) axyp.push_back(aa[i]);
    }
    sort(ax.begin(), ax.end());
    sort(ay.begin(), ay.end());
    sort(axyn.begin(), axyn.end(), [&](auto a, auto b) {
        return a.first.second > b.first.second;
    });
    sort(axyp.begin(), axyp.end(), [&](auto a, auto b) {
        return a.first.second < b.first.second;
    });

    vector <int> ids;

    for (auto [p, id] : ax) ids.push_back(id);
    for (auto [p, id] : axyp) ids.push_back(id);
    for (auto [p, id] : axyn) ids.push_back(id);
    for (auto [p, id] : ay) ids.push_back(id);

    string fin = "";
    for (int i = 0; i < (int) ids.size(); ++i) fin += a[ids[i]];
    auto [o, c] = get_p(fin);
    if (o != 0 || c != 0) cout << "impossible\n";
    else {
        for (int x : ids) cout << x + 1 << '\n';
    }
}

詳細信息

Test #1:

score: 100
Accepted
time: 24ms
memory: 7676kb

input:

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

output:

13
29
65
69
103
129
133
163
164
172
178
241
307
383
418
506
540
542
586
608
652
687
826
896
919
925
929
969
1021
1031
1060
1093
1141
1170
1334
1491
1677
1689
1753
1767
1911
1946
1978
2004
2087
2135
2170
2216
2238
2321
2380
2420
2472
2540
2551
2560
2665
2724
2735
2743
2768
2812
2892
2933
2937
3064
30...

result:

ok good plan

Test #2:

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

input:

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

output:

30
35
45
84
85
112
115
123
128
197
221
297
397
429
433
489
596
617
626
653
762
788
790
879
962
983
1
3
10
12
14
18
22
54
58
64
65
75
77
89
90
92
97
101
104
106
110
122
125
126
135
136
143
147
162
166
178
179
181
182
188
189
190
198
206
209
212
213
215
216
217
223
228
229
242
243
245
247
252
253
265
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

1
2
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
1
3
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

3
1
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

74
204
304
348
401
438
1
4
6
7
10
11
12
13
16
17
19
20
22
23
24
26
27
29
31
33
36
37
38
40
41
45
46
49
51
52
53
55
56
58
59
60
62
65
66
69
70
71
72
73
75
76
77
78
79
82
83
85
86
87
90
91
92
94
95
96
99
102
104
105
106
107
109
114
117
120
124
128
129
130
131
132
133
136
139
141
143
149
152
153
156
15...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

result:

ok good plan

Test #17:

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

input:

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

output:

19
58
80
105
197
252
276
297
332
360
391
414
425
489
516
554
572
591
671
750
7
9
13
16
17
20
21
22
27
37
45
48
57
62
65
66
67
69
74
81
82
95
97
101
112
116
121
136
138
141
148
150
152
155
157
159
160
162
169
172
175
176
181
182
184
185
186
191
195
208
212
213
214
220
224
225
227
228
229
231
238
243
...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

score: 0
Accepted
time: 377ms
memory: 79884kb

input:

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

output:

32
215
326
405
435
460
537
538
669
711
797
870
934
960
1099
1204
1327
1350
1352
1379
1387
1405
1406
1493
1547
1664
1687
1869
1944
1956
2071
2098
2111
2174
2207
2208
2227
2242
2243
2315
2391
2422
2431
2457
2507
2576
2630
2723
2871
2972
2977
3076
3140
3157
3183
3204
3214
3240
3288
3307
3314
3377
3490
...

result:

ok good plan

Test #26:

score: 0
Accepted
time: 77ms
memory: 32804kb

input:

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

output:

impossible

result:

ok impossible

Test #27:

score: 0
Accepted
time: 85ms
memory: 32872kb

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 71ms
memory: 27596kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

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

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

score: 0
Accepted
time: 77ms
memory: 32256kb

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

score: 0
Accepted
time: 223ms
memory: 84892kb

input:

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

output:

impossible

result:

ok impossible

Test #35:

score: 0
Accepted
time: 212ms
memory: 84928kb

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 309ms
memory: 81008kb

input:

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

output:

2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
40
42
44
46
48
50
52
54
56
58
60
62
64
66
68
70
72
74
76
78
80
82
84
86
88
90
92
94
96
98
100
102
104
106
108
110
112
114
116
118
120
122
124
126
128
130
132
134
136
138
140
142
144
146
148
150
152
154
156
158
160
162
164
166
168
170
172
174
176
1...

result:

ok good plan

Test #37:

score: 0
Accepted
time: 270ms
memory: 95100kb

input:

999999
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)
)...

output:

500001
500002
500003
500004
500005
500006
500007
500008
500009
500010
500011
500012
500013
500014
500015
500016
500017
500018
500019
500020
500021
500022
500023
500024
500025
500026
500027
500028
500029
500030
500031
500032
500033
500034
500035
500036
500037
500038
500039
500040
500041
500042
500043...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 457ms
memory: 90936kb

input:

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

output:

10
20
93
146
151
176
239
251
252
258
300
311
313
381
447
463
483
529
537
543
544
596
620
658
665
694
721
743
789
796
797
798
802
826
839
881
904
921
945
1008
1035
1046
1109
1183
1271
1279
1286
1298
1310
1311
1322
1324
1327
1347
1361
1390
1400
1440
1450
1472
1481
1482
1487
1530
1532
1537
1559
1603
16...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 471ms
memory: 91000kb

input:

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

output:

6
19
20
23
26
46
97
100
157
230
273
282
284
290
327
342
384
397
398
437
484
489
495
504
552
564
566
573
586
589
620
656
681
709
713
718
736
738
757
765
788
858
868
895
948
955
969
979
982
987
1039
1098
1109
1123
1140
1142
1158
1195
1210
1280
1335
1349
1353
1357
1370
1372
1374
1402
1446
1524
1528
156...

result:

ok good plan

Test #40:

score: 0
Accepted
time: 161ms
memory: 24728kb

input:

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

output:

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

result:

ok good plan

Test #41:

score: 0
Accepted
time: 149ms
memory: 24536kb

input:

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

output:

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

result:

ok good plan

Test #42:

score: 0
Accepted
time: 158ms
memory: 33904kb

input:

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

output:

351
370
424
635
953
1216
1279
1922
2223
2243
2362
3099
3135
3150
3295
3630
3695
3915
4045
4173
4524
4934
5092
5237
5323
6031
6343
6782
7030
7075
7133
7140
7523
7571
7626
7675
7692
7833
8012
8055
8357
8642
8681
8858
9532
10286
10603
11040
11145
11366
11719
11739
11758
11853
12055
12130
12170
12523
13...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 384ms
memory: 77124kb

input:

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

output:

3
21
48
65
143
144
167
188
208
227
236
300
303
326
327
331
343
379
435
492
540
541
542
599
603
693
747
777
787
802
842
843
844
845
882
913
937
943
964
986
999
1000
1007
1020
1089
1096
1120
1140
1142
1150
1215
1282
1307
1362
1390
1411
1425
1470
1490
1599
1640
1644
1668
1684
1698
1725
1738
1749
1775
1...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

input:

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

output:

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

result:

ok good plan

Test #51:

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

input:

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

output:

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

result:

ok good plan

Test #53:

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

input:

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

output:

24
69
80
91
92
99
110
113
116
120
131
158
159
170
174
197
204
211
237
270
273
274
277
284
286
305
306
313
339
343
375
421
425
444
446
470
482
494
495
508
515
534
550
551
571
585
592
606
607
609
613
616
640
654
657
672
688
689
730
741
750
754
755
772
774
809
812
820
824
850
864
889
921
930
931
962
97...

result:

ok good plan

Test #54:

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

input:

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

output:

68
109
125
235
268
322
348
372
396
487
518
521
553
554
556
571
597
599
615
786
791
801
825
855
872
879
892
928
943
948
1006
1033
1076
1077
1095
1127
1136
1137
1206
1232
1310
1345
1394
1413
1422
1423
1474
1508
1531
1565
1591
1610
1675
1754
1759
1834
1844
1846
1847
1852
1880
1887
1891
1953
1984
2013
2...

result:

ok good plan

Test #55:

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

input:

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

output:

15
27
31
34
55
60
65
76
77
90
96
100
106
110
113
129
150
161
169
191
225
237
255
260
340
343
345
378
387
391
399
436
447
461
466
473
474
488
490
498
516
523
540
552
595
604
626
630
643
650
662
663
667
682
684
718
723
736
786
822
951
958
975
976
983
985
988
1018
1041
1053
1071
1082
1100
1107
1153
116...

result:

ok good plan

Test #56:

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

input:

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

output:

43
53
68
86
92
108
111
119
134
140
176
179
195
202
204
211
342
378
385
421
426
442
464
465
480
487
494
525
553
558
562
609
613
619
637
650
685
689
753
763
767
781
859
882
895
906
930
966
986
989
994
1002
1014
1042
1046
1066
1111
1176
1186
1193
1226
1236
1246
1251
1275
1283
1293
1296
1302
1318
1331
1...

result:

ok good plan

Test #57:

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

input:

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

output:

19
23
30
67
68
80
152
153
165
191
199
241
267
269
288
309
311
326
346
367
373
374
386
393
397
408
426
430
518
521
542
546
560
568
612
620
623
625
633
638
664
682
695
724
734
741
761
769
796
801
805
839
850
853
872
875
880
915
962
1001
1011
1041
1074
1075
1094
1119
1133
1138
1152
1154
1161
1168
1218
...

result:

ok good plan

Test #58:

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

input:

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

output:

69
92
113
143
163
222
229
236
277
285
294
325
350
353
369
375
449
475
486
490
507
514
538
544
547
552
554
566
583
602
617
657
660
669
674
685
686
688
698
705
724
728
736
792
800
816
820
868
877
887
908
915
922
929
962
994
1007
1034
1040
1043
1050
1074
1079
1092
1094
1099
1102
1112
1119
1132
1143
115...

result:

ok good plan

Test #59:

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

input:

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

output:

5
21
40
48
65
72
82
99
110
111
119
132
137
152
182
199
200
211
213
235
279
294
320
325
355
387
389
428
435
465
482
491
507
514
529
532
542
553
561
565
569
608
616
617
620
627
633
637
649
673
683
689
697
727
742
776
777
804
805
830
831
833
840
847
849
855
858
862
882
888
893
914
929
951
952
954
961
9...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

57
92
179
291
493
503
596
620
722
914
946
948
1221
1261
1339
1378
1799
1880
1958
2170
2222
2284
2308
2329
2841
3071
3185
3436
3602
3628
3632
3665
3730
3749
3909
4200
4230
4365
4514
4776
4869
5087
5137
5302
5366
5473
5477
5691
5738
5747
5756
5835
5901
6234
6448
6486
6775
6780
6854
6953
7000
1
2
4
5
6...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

input:

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

output:

9
3
4
5
6
7
10
8
1
2
11

result:

ok good plan

Test #64:

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

input:

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

output:

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

result:

ok good plan

Test #65:

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

input:

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

output:

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

result:

ok good plan

Test #66:

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

input:

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

output:

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

result:

ok good plan

Test #67:

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

input:

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

output:

2
7
8
10
1
3
5
6
9
4

result:

ok good plan

Test #68:

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

input:

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

output:

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

result:

ok good plan

Test #69:

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

1
5
3
2
6
4

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed