QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#379870#5108. Prehistoric Programscciafrino#AC ✓167ms29540kbC++201.7kb2024-04-06 19:38:012024-04-06 19:38:02

Judging History

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

  • [2024-04-06 19:38:02]
  • 评测
  • 测评结果:AC
  • 用时:167ms
  • 内存:29540kb
  • [2024-04-06 19:38:01]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    int N; cin >> N;

    int total_balance = 0;
    vector<int> good, bad;
    vector<pair<int, int>> v(N);
    for (int i =0; i < N; ++i) {
        string S; cin >> S;
        int minus = 0, plus = 0;
        int balance = 0, min_balance = 1e9;
        for (auto c : S) {
            if (c == ')') {
                minus++;
                balance -= 1;
            }
            else {
                plus++;
                balance += 1;
            }
            min_balance = min(min_balance, balance);
        }

        v[i] = {min_balance, balance};
        total_balance += balance;
        if (balance < 0) {
            bad.push_back(i);
        } else {
            good.push_back(i);
        }
    }

    if (total_balance != 0) {
        cout << "impossible\n";
    } else {
        sort(good.begin(), good.end(), [&](const auto& l, const auto& r) {
            return v[l].first > v[r].first;
        });
        sort(bad.begin(), bad.end(), [&](const auto& l, const auto& r) {
            return v[l].first - v[l].second < v[r].first - v[r].second;
        });

        int sum = 0;
        bool is_bad = false;
        for (auto id : good) {
            is_bad |= (sum + v[id].first < 0);
            sum += v[id].second;
        }
        for (auto id : bad) {
            is_bad |= (sum + v[id].first < 0);
            sum += v[id].second;
        }

        if (!is_bad) {
            for (int id : good) cout << id+1 << '\n';
            for (int id : bad) cout << id+1 << '\n';
        } else {
            cout << "impossible\n";
        }
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 8ms
memory: 4040kb

input:

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

output:

30754
30788
30786
30781
30779
30778
30775
30771
30766
30765
30764
30790
30750
30748
30747
30746
30745
30743
30741
30737
30736
30735
30810
30860
30859
30857
30856
30855
30850
30847
30845
30834
30813
30734
30809
30804
30803
30799
30798
30797
30796
30793
30792
30791
30660
30680
30677
30672
30671
30669
...

result:

ok good plan

Test #2:

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

input:

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

output:

655
685
287
681
680
291
673
668
667
666
663
301
662
309
659
316
282
324
652
327
329
650
646
334
335
640
636
632
628
347
615
611
252
216
217
752
748
223
228
229
747
746
738
242
243
732
245
247
604
253
257
258
725
719
715
711
265
267
268
707
271
689
687
280
516
422
557
426
554
553
430
544
535
534
439
...

result:

ok good plan

Test #3:

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

input:

2
()
()

output:

1
2

result:

ok good plan

Test #4:

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

input:

2
((
))

output:

1
2

result:

ok good plan

Test #5:

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

input:

2
)(
()

output:

impossible

result:

ok impossible

Test #6:

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

input:

3
()
(
)

output:

2
1
3

result:

ok good plan

Test #7:

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

input:

3
)(
(
)

output:

2
1
3

result:

ok good plan

Test #8:

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

input:

5
))(
(()
)(
(
)

output:

2
4
3
1
5

result:

ok good plan

Test #9:

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

input:

3
((
))())
(

output:

1
3
2

result:

ok good plan

Test #10:

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

input:

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

output:

impossible

result:

ok impossible

Test #11:

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

input:

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

output:

327
285
286
287
288
290
296
297
308
309
311
315
318
320
321
325
284
329
330
334
338
339
340
343
344
345
349
351
353
356
357
253
226
227
228
232
234
239
1
241
242
243
247
248
249
251
360
254
256
258
262
264
265
268
269
271
274
275
277
282
283
467
429
431
434
435
436
437
439
440
442
445
449
452
456
45...

result:

ok good plan

Test #12:

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

input:

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

output:

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

result:

ok good plan

Test #13:

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

input:

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

output:

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

result:

ok good plan

Test #14:

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

input:

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

output:

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

result:

ok good plan

Test #15:

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

input:

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

output:

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

result:

ok good plan

Test #16:

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

input:

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

output:

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

input:

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

output:

429
450
446
442
441
440
437
434
432
455
427
419
418
417
409
408
407
406
490
518
512
502
500
495
494
492
491
401
485
481
477
475
470
469
468
461
330
348
345
343
341
338
335
333
331
357
326
324
304
294
287
281
274
265
383
397
396
395
392
390
387
385
384
522
378
374
371
369
368
362
358
665
684
680
677
...

result:

ok good plan

Test #18:

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

input:

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

output:

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

result:

ok good plan

Test #19:

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

input:

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

output:

impossible

result:

ok impossible

Test #20:

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

input:

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

output:

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

result:

ok good plan

Test #21:

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

input:

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

output:

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

result:

ok good plan

Test #22:

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

input:

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

output:

impossible

result:

ok impossible

Test #23:

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

input:

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

output:

impossible

result:

ok impossible

Test #24:

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

input:

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

output:

impossible

result:

ok impossible

Test #25:

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

input:

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

output:

626447
626485
626484
626483
626482
626481
626480
626476
626471
626470
626467
626459
626458
626457
626453
626493
626446
626445
626441
626438
626437
626436
626435
626429
626427
626424
626423
626421
626420
626527
626559
626554
626553
626550
626546
626542
626541
626540
626538
626536
626532
626531
626528...

result:

ok good plan

Test #26:

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

input:

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

output:

impossible

result:

ok impossible

Test #27:

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

input:

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

output:

impossible

result:

ok impossible

Test #28:

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

input:

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

output:

1

result:

ok good plan

Test #29:

score: 0
Accepted
time: 11ms
memory: 20532kb

input:

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

output:

impossible

result:

ok impossible

Test #30:

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

input:

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

output:

impossible

result:

ok impossible

Test #31:

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

input:

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

output:

2
1

result:

ok good plan

Test #32:

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

input:

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

output:

impossible

result:

ok impossible

Test #33:

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

input:

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

output:

3
1
2

result:

ok good plan

Test #34:

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

input:

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

output:

impossible

result:

ok impossible

Test #35:

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

input:

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

output:

impossible

result:

ok impossible

Test #36:

score: 0
Accepted
time: 87ms
memory: 15300kb

input:

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

output:

666658
666688
666686
666684
666682
666680
666678
666676
666674
666672
666670
666668
666666
666664
666662
666660
666690
666656
666654
666652
666650
666648
666646
666644
666642
666640
666638
666636
666634
666632
666630
666720
666750
666748
666746
666744
666742
666740
666738
666736
666734
666732
666730...

result:

ok good plan

Test #37:

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

input:

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

output:

833328
833343
833342
833341
833340
833339
833338
833337
833336
833335
833334
833333
833332
833331
833330
833329
833344
833327
833326
833325
833324
833323
833322
833321
833320
833319
833318
833317
833316
833315
833314
833359
833374
833373
833372
833371
833370
833369
833368
833367
833366
833365
833364...

result:

ok good plan

Test #38:

score: 0
Accepted
time: 155ms
memory: 17056kb

input:

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

output:

246206
744665
858328
858327
858322
246192
858320
246196
443843
594340
443842
246202
594339
858335
246207
246208
443840
443831
246217
594336
443829
443824
246229
658720
858301
858343
858363
858362
858361
858357
246142
858355
246145
443860
858352
246151
561666
246155
594331
443857
246164
744663
858340...

result:

ok good plan

Test #39:

score: 0
Accepted
time: 167ms
memory: 17596kb

input:

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

output:

654585
271060
271061
271067
654616
271072
654611
654603
654600
654599
654594
271090
654592
654590
654619
271097
271101
654579
654578
654576
654571
654567
654565
271113
271123
654548
654542
654646
654702
654701
654699
654689
654688
654685
271010
654678
654675
654653
271022
654650
654539
654642
271036...

result:

ok good plan

Test #40:

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

input:

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

output:

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

result:

ok good plan

Test #41:

score: 0
Accepted
time: 43ms
memory: 4316kb

input:

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

output:

48
12
75
7
81
36
33
76
99
16
10
105
59
108
70
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
88
2
31
1
34
19
25
32
4
77
100
30
11
86
20
14
50
35
73
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
74
37
18
104
49
42
38
83...

result:

ok good plan

Test #42:

score: 0
Accepted
time: 49ms
memory: 4268kb

input:

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

output:

56181
35258
35260
9927
9925
56192
61796
9904
35373
61799
56182
35237
56158
35471
35477
35485
56150
9833
56143
56141
35551
35166
10034
35093
35105
35106
10019
56217
35111
10008
35149
35562
61788
9987
35205
35209
9972
9969
35214
35222
9957
9641
35804
35814
9684
9682
9678
35828
35830
35833
9651
56095
3...

result:

ok good plan

Test #43:

score: 0
Accepted
time: 128ms
memory: 12736kb

input:

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

output:

245331
245295
245305
578167
578159
578155
578152
578151
578150
245322
245329
578174
578142
578141
578139
578138
245360
578123
245365
245368
245370
245243
245208
578251
578248
245219
245224
578220
245231
578214
578213
245382
578205
245256
578192
245265
578184
245279
245281
245282
245290
578047
245451...

result:

ok good plan

Test #44:

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

input:

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

output:

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

result:

ok good plan

Test #45:

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

input:

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

output:

6
3
7
2
1
4
5
8

result:

ok good plan

Test #46:

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

input:

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

output:

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

result:

ok good plan

Test #47:

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

input:

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

output:

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

result:

ok good plan

Test #48:

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

input:

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

output:

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

result:

ok good plan

Test #49:

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

input:

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

output:

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

result:

ok good plan

Test #50:

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

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

input:

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

output:

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

result:

ok good plan

Test #52:

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

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

input:

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

output:

2155
2181
2179
2178
2176
2173
2170
2168
2166
2164
2163
2162
2161
2182
2152
2149
2147
2144
2141
2139
2136
2135
2131
2124
2119
2115
2211
2237
2234
2231
2230
2228
2226
2225
2224
2223
2222
2218
2214
2113
2208
2205
2204
2202
2201
2199
2195
2193
2192
2188
2187
1998
2030
2027
2024
2020
2016
2015
2013
2012
...

result:

ok good plan

Test #54:

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

input:

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

output:

5072
5039
5040
5041
5043
5044
5045
5046
5049
5053
5057
5058
5060
5061
5063
5071
5038
5074
5075
5078
5082
5084
5085
5086
5092
5101
5103
5104
5106
5107
5111
5013
4988
4993
4994
4995
4997
4998
4999
5001
5002
5005
5006
5007
5009
5010
5011
5116
5016
5018
5022
5023
5024
5025
5026
5028
5029
5030
5033
5034
...

result:

ok good plan

Test #55:

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

input:

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

output:

1312
1277
1281
1283
1286
1288
1291
1297
1298
1299
1300
1301
1306
1310
1273
1313
1315
1318
1319
1320
1331
1337
1339
1341
1342
1348
1357
1358
1200
1157
1159
1162
1163
1167
1172
1174
1176
1177
1179
1182
1187
1199
1359
1211
1215
1217
1220
1222
1226
1233
1239
1247
1253
1259
1265
1269
1490
1442
1448
1450
...

result:

ok good plan

Test #56:

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

input:

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

output:

1997
2027
3456
2024
3457
2021
3460
2008
2007
3461
2005
2001
3462
1998
2029
1994
3465
1991
3468
3471
1986
1985
1984
1982
3472
1980
1978
3445
2075
2074
2073
3438
2068
2061
3442
2059
2058
3443
2053
2052
1976
3447
2048
2047
3451
2045
2043
2037
2036
2035
2033
2032
2030
3498
1929
3481
3483
1919
1918
1917
...

result:

ok good plan

Test #57:

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

input:

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

output:

2923
2910
2911
4825
2913
2914
2920
2921
2922
2905
2926
2927
4822
2933
2937
2938
2941
2943
4828
2866
2870
2871
2875
2876
2879
4829
2884
2948
2886
2889
2891
2892
2893
2895
2896
2901
3001
2986
2987
4810
2991
2992
2993
4809
2999
2985
3002
3006
3008
3011
3014
3015
3017
3021
2972
2952
2953
2954
2956
2957
...

result:

ok good plan

Test #58:

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

input:

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

output:

2034
2055
2050
2049
2047
2046
2044
2043
2042
2041
2039
2038
2035
2056
2031
2029
2025
2024
2022
2017
2015
2011
2008
2007
2004
2003
2082
2132
2131
2124
2122
2119
2109
2103
2101
2098
2094
2088
2086
2001
2078
2076
2075
2074
2070
2069
2068
2067
2066
2062
2057
1920
1944
1942
1941
1939
1938
1937
1936
1933
...

result:

ok good plan

Test #59:

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

input:

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

output:

2244
2295
2292
2280
2275
2271
2270
2269
2268
2267
2266
2262
2260
2253
2302
2243
2239
2238
2237
2233
2231
2230
2229
2226
2217
2216
2212
2211
2341
2374
2367
2366
2364
2363
2362
2361
2356
2355
2349
2344
2343
2342
2206
2340
2338
2329
2328
2327
2326
2318
2313
2311
2306
2305
2304
2087
2151
2150
2143
2142
...

result:

ok good plan

Test #60:

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

input:

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

output:

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

result:

ok good plan

Test #61:

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

input:

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

output:

4668
4634
4637
4638
4640
4644
4645
4646
4650
4651
4654
4659
4662
4664
4632
4669
4672
4677
4680
4681
4682
4683
4685
4690
4692
4694
4696
4698
4610
4581
4587
4589
4590
4592
4593
4595
4596
4598
4602
4606
4608
4609
4700
4611
4612
4613
4619
4620
4621
4622
4623
4625
4626
4628
4630
4631
4794
4766
4767
4769
...

result:

ok good plan

Test #62:

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

input:

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

output:

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

result:

ok good plan

Test #63:

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

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

input:

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

output:

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

result:

ok good plan

Test #65:

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

input:

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

output:

24
44
43
42
38
35
34
33
32
28
3
22
21
20
18
16
14
11
9
8
6
37
23
45
41
40
39
36
31
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: 3584kb

input:

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

output:

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

result:

ok good plan

Test #67:

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

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

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

input:

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

output:

2
1
3

result:

ok good plan

Test #70:

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

input:

1
(

output:

impossible

result:

ok impossible

Test #71:

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

input:

1
)

output:

impossible

result:

ok impossible

Test #72:

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

input:

1
)(

output:

impossible

result:

ok impossible

Test #73:

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

input:

1
()

output:

1

result:

ok good plan

Test #74:

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

input:

2
(
)

output:

1
2

result:

ok good plan

Test #75:

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

input:

2
)
(

output:

2
1

result:

ok good plan

Test #76:

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

input:

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

output:

3
5
1
2
4
6

result:

ok good plan

Extra Test:

score: 0
Extra Test Passed