QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#294646#4824. Bracket-and-bar Sequencesucup-team1704#0 2ms3560kbC++202.0kb2023-12-30 15:17:462023-12-30 15:17:47

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3492kb

input:

encode
3
1
(|)
4
((((|)|)|)|)
5
(|(|))((|(|))|)

output:

2
80
45259

input:

decode
3
1
2
4
80
5
45259

output:

(|)
((((|)|)|)|)
(|(|))((|(|))|)

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

2

input:

decode
1
1
2

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

encode
3
2
((|)|)
1
(|)
2
(|(|))

output:

8
2
20

input:

decode
3
2
8
1
2
2
20

output:

((|)|)
(|)
(|(|))

result:

ok 3 lines

Test #4:

score: 100
Accepted
time: 1ms
memory: 3488kb

input:

encode
1000
3
(|)(|)(|)
3
(|)(|(|))
3
(|)((|)|)
3
(|(|))(|)
3
(|(|)(|))
3
(|(|(|)))
3
(|((|)|))
3
((|)|)(|)
3
((|)|(|))
3
((|)(|)|)
3
((|(|))|)
3
(((|)|)|)
4
(|)(|)(|)(|)
4
(|)(|)(|(|))
4
(|)(|)((|)|)
4
(|)(|(|))(|)
4
(|)(|(|)(|))
4
(|)(|(|(|)))
4
(|)(|((|)|))
4
(|)((|)|)(|)
4
(|)((|)|(|))
4
(|)((|)...

output:

13630
1627
655
1519
1523
182
74
1483
170
509
62
26
1103773
131728
52996
122980
123370
14749
6001
120064
13777
41236
5029
2113
122656
14641
5893
122668
13669
13345
122672
14645
5897
13673
13709
1640
668
13349
1532
4583
560
236
122548
14605
5857
13633
13697
1628
656
119626
13309
13201
13631
1520
1484
...

input:

decode
1000
3
13630
3
1627
3
655
3
1519
3
1523
3
182
3
74
3
1483
3
170
3
509
3
62
3
26
4
1103773
4
131728
4
52996
4
122980
4
123370
4
14749
4
6001
4
120064
4
13777
4
41236
4
5029
4
2113
4
122656
4
14641
4
5893
4
122668
4
13669
4
13345
4
122672
4
14645
4
5897
4
13673
4
13709
4
1640
4
668
4
13349
4
15...

output:

(|)(|)(|)
(|)(|(|))
(|)((|)|)
(|(|))(|)
(|(|)(|))
(|(|(|)))
(|((|)|))
((|)|)(|)
((|)|(|))
((|)(|)|)
((|(|))|)
(((|)|)|)
(|)(|)(|)(|)
(|)(|)(|(|))
(|)(|)((|)|)
(|)(|(|))(|)
(|)(|(|)(|))
(|)(|(|(|)))
(|)(|((|)|))
(|)((|)|)(|)
(|)((|)|(|))
(|)((|)(|)|)
(|)((|(|))|)
(|)(((|)|)|)
(|(|))(|)(|)
(|(|))(|(|)...

result:

ok 1000 lines

Test #5:

score: 100
Accepted
time: 1ms
memory: 3560kb

input:

encode
1000
6
(|((((|)|)|)|)(|))
6
(|((|)(|)(|)|(|)))
6
(|((|)(|(|))|(|)))
6
(|((|)((|)|)|(|)))
6
(|((|(|))(|)|(|)))
6
(|((|(|)(|))|(|)))
6
(|((|(|(|)))|(|)))
6
(|((|((|)|))|(|)))
6
(|(((|)|)(|)|(|)))
6
(|(((|)|(|))|(|)))
6
(|(((|)(|)|)|(|)))
6
(|(((|(|))|)|(|)))
6
(|((((|)|)|)|(|)))
6
(|((|)(|)(|)(...

output:

1065053
9933968
1106831
1080587
1103915
1104023
123032
120116
1102943
122708
1076645
119792
118820
29801891
3556676
1430912
3320480
3331010
398243
162047
3241748
371999
1113392
135803
57071
3311732
395327
159131
3312056
369083
360335
3312164
395435
159239
369191
370163
44300
18056
360443
41384
12376...

input:

decode
1000
6
1065053
6
9933968
6
1106831
6
1080587
6
1103915
6
1104023
6
123032
6
120116
6
1102943
6
122708
6
1076645
6
119792
6
118820
6
29801891
6
3556676
6
1430912
6
3320480
6
3331010
6
398243
6
162047
6
3241748
6
371999
6
1113392
6
135803
6
57071
6
3311732
6
395327
6
159131
6
3312056
6
369083
6...

output:

(|((((|)|)|)|)(|))
(|((|)(|)(|)|(|)))
(|((|)(|(|))|(|)))
(|((|)((|)|)|(|)))
(|((|(|))(|)|(|)))
(|((|(|)(|))|(|)))
(|((|(|(|)))|(|)))
(|((|((|)|))|(|)))
(|(((|)|)(|)|(|)))
(|(((|)|(|))|(|)))
(|(((|)(|)|)|(|)))
(|(((|(|))|)|(|)))
(|((((|)|)|)|(|)))
(|((|)(|)(|)(|)|))
(|((|)(|)(|(|))|))
(|((|)(|)((|)|)...

result:

ok 1000 lines

Test #6:

score: 100
Accepted
time: 1ms
memory: 3492kb

input:

encode
1000
7
((|)(|(|(|)(|)))|(|))
7
((|)(|(|)(|)(|))(|)|)
7
(|(|(|)((|)|))(|(|)))
7
((|(|))|(|))(|(|))(|)
7
(|)((|(|)((|)|)(|))|)
7
(((|(|)(|))|((|)|))|)
7
((|)((|(|))(|(|))|)|)
8
(|)(|)(|(|))((|((|)|))|)
7
((|)|)((|)|)(((|)|)|)
7
(|)((|)|)(((|)|(|))|)
7
(|((|)|(|)))(|(|)(|))
7
((|)|(|(|)((|)|))(|...

output:

89424752
2413950890
95818610
89650066
262580623
1430891
10673798
1071780241
13835038
30235054
89936224
87526502
28165432792
787613269
96028454
9937073
804619771
809389231
1108019
19610
3595655
87288172
29811506
9686132
394370
87575524
38321122
38623090
9970610
87207280
38277520
38690768
86571124
864...

input:

decode
1000
7
89424752
7
2413950890
7
95818610
7
89650066
7
262580623
7
1430891
7
10673798
8
1071780241
7
13835038
7
30235054
7
89936224
7
87526502
8
28165432792
7
787613269
7
96028454
7
9937073
7
804619771
7
809389231
7
1108019
7
19610
7
3595655
7
87288172
7
29811506
7
9686132
7
394370
7
87575524
7...

output:

((|)(|(|(|)(|)))|(|))
((|)(|(|)(|)(|))(|)|)
(|(|(|)((|)|))(|(|)))
((|(|))|(|))(|(|))(|)
(|)((|(|)((|)|)(|))|)
(((|(|)(|))|((|)|))|)
((|)((|(|))(|(|))|)|)
(|)(|)(|(|))((|((|)|))|)
((|)|)((|)|)(((|)|)|)
(|)((|)|)(((|)|(|))|)
(|((|)|(|)))(|(|)(|))
((|)|(|(|)((|)|))(|))
(|)(|)(|)((|)|(|))((|)|)
((|)((|)...

result:

ok 1000 lines

Test #7:

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

input:

encode
1000
7
(|(|)(|)(|(((|)|)|)))
7
(((|)|)((|)|)(|(|))|)
7
(|(|))((|)(|)|(|(|)))
7
(|)(|((|((|(|))|))|))
7
(|((|)|(|))(|((|)|)))
7
(|)((|(|)(|(|)))(|)|)
7
(((|)(|)(|)|)|(|(|)))
7
((|(|))|)((|)|)(|(|))
7
(|)(|(|((|)(|)|(|))))
7
(((|)(|)|)|(|))(|)(|)
7
(|)(|(|(|)((|)|))(|))
7
((|)(|)|(((|)|)|(|)))
...

output:

13940138
31939178
96030502
1226347
4374227
268956943
95782058
95817406
89434618
804615439
787738615
9737033
65183487088
574253192101
87558028
89323582
39344326
86570422
7270508065
7070686249
86570764
89406218
1540886
1417901
862015003
89406286
1067978
89710072
7243663498
1102949
269914507
4256615
11...

input:

decode
1000
7
13940138
7
31939178
7
96030502
7
1226347
7
4374227
7
268956943
7
95782058
7
95817406
7
89434618
7
804615439
7
787738615
7
9737033
8
65183487088
8
574253192101
7
87558028
7
89323582
7
39344326
7
86570422
8
7270508065
8
7070686249
7
86570764
7
89406218
7
1540886
7
1417901
7
862015003
7
8...

output:

(|(|)(|)(|(((|)|)|)))
(((|)|)((|)|)(|(|))|)
(|(|))((|)(|)|(|(|)))
(|)(|((|((|(|))|))|))
(|((|)|(|))(|((|)|)))
(|)((|(|)(|(|)))(|)|)
(((|)(|)(|)|)|(|(|)))
((|(|))|)((|)|)(|(|))
(|)(|(|((|)(|)|(|))))
(((|)(|)|)|(|))(|)(|)
(|)(|(|(|)((|)|))(|))
((|)(|)|(((|)|)|(|)))
(|)(|)(|(|(|(|))))(|)(|)
(|)(|)(|)(|...

result:

ok 1000 lines

Test #8:

score: 100
Accepted
time: 2ms
memory: 3520kb

input:

encode
1000
7
(((|)|(|)(|)(|)(|))|)
7
(|)(|(|(|)))((|(|))|)
7
((|)|)(|((|)|))(|(|))
7
(|(|(|)))((|(|(|)))|)
7
(((|)(|)|)|(|(|)))(|)
7
((|)((((|)|)|)|)|(|))
7
(|((|((|)|(|))(|))|))
7
((|)(((|)(|)(|)|)|)|)
8
(|)(|)(|)(|(|))((|)|(|))
7
(|(|(|))(|)((|(|))|))
7
((((|(|))|)(|)(|)|)|)
7
(|(|))((|)(|)|)((|)...

output:

268216865
32993590
95821294
3595975
89640970
9585401
3312893
29810777
65893492264
32990366
9925298
345487135
30237538
3322133
10051531
32255746
3674711
9966347
10635161
86465446
1107587
90290371
4295491
804792571
89339458
3229928
11106484
89433178
1108735
38623106
90392420
10646891
7241574334
803662...

input:

decode
1000
7
268216865
7
32993590
7
95821294
7
3595975
7
89640970
7
9585401
7
3312893
7
29810777
8
65893492264
7
32990366
7
9925298
7
345487135
7
30237538
7
3322133
7
10051531
7
32255746
7
3674711
7
9966347
7
10635161
7
86465446
7
1107587
7
90290371
7
4295491
7
804792571
7
89339458
7
3229928
7
1110...

output:

(((|)|(|)(|)(|)(|))|)
(|)(|(|(|)))((|(|))|)
((|)|)(|((|)|))(|(|))
(|(|(|)))((|(|(|)))|)
(((|)(|)|)|(|(|)))(|)
((|)((((|)|)|)|)|(|))
(|((|((|)|(|))(|))|))
((|)(((|)(|)(|)|)|)|)
(|)(|)(|)(|(|))((|)|(|))
(|(|(|))(|)((|(|))|))
((((|(|))|)(|)(|)|)|)
(|(|))((|)(|)|)((|)|)
((|)|)(|)(((|)|(|))|)
((((|)|)|(|...

result:

ok 1000 lines

Test #9:

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

input:

encode
1000
7
((|(|)(|(|)))|)((|)|)
7
(|(|))((|(|(|(|))))|)
7
(|)(|(|((|)(|)|)))(|)
8
(|)(|)(|(|)(|))(|(|(|)))
7
(|((((|(|))|)|(|))|))
7
(((|(|))|)|)(|)((|)|)
7
((|(|))((|)|)|((|)|))
7
(((|(|))(|)|)(|)(|)|)
7
(|(|))(|(|)(|)(|)(|))
7
(((|)((|)|)|(|))(|)|)
7
((|(|)((|(|))|))(|)|)
7
(|)((|(|))(|)|((|)|...

output:

38395564
3588199
784864507
70540507732
359390
38619742
4269209
267969371
7241856172
29778404
29105186
38633038
784448215
804843763
9992951
862037359
804646555
808691873
513413
65188542568
38387176
775956127
89413990
69777263092
10669829
3595979
4258015
347580121
2420553058
38309458
6987781453
804646...

input:

decode
1000
7
38395564
7
3588199
7
784864507
8
70540507732
7
359390
7
38619742
7
4269209
7
267969371
7
7241856172
7
29778404
7
29105186
7
38633038
7
784448215
7
804843763
7
9992951
7
862037359
7
804646555
7
808691873
7
513413
8
65188542568
7
38387176
7
775956127
7
89413990
8
69777263092
7
10669829
7...

output:

((|(|)(|(|)))|)((|)|)
(|(|))((|(|(|(|))))|)
(|)(|(|((|)(|)|)))(|)
(|)(|)(|(|)(|))(|(|(|)))
(|((((|(|))|)|(|))|))
(((|(|))|)|)(|)((|)|)
((|(|))((|)|)|((|)|))
(((|(|))(|)|)(|)(|)|)
(|(|))(|(|)(|)(|)(|))
(((|)((|)|)|(|))(|)|)
((|(|)((|(|))|))(|)|)
(|)((|(|))(|)|((|)|))
((((|)(|)|)|)(|)|)(|)
(|(|))((|)|...

result:

ok 1000 lines

Test #10:

score: 100
Accepted
time: 1ms
memory: 3440kb

input:

encode
1000
7
((((|)|(|)(|))|)(|)|)
7
(((|)(|)|)(|)(|(|))|)
7
(|)(|((|(|)(|))(|)|))
7
(|(|)(((|)|)|(|))(|))
7
(|)((|(|))|(|(|(|))))
7
((|(|)(|)(|)(|))|)(|)
7
(|((|)(|(|)((|)|))|))
7
(((|)|(|))|)((|)|)(|)
7
(|)(((|(|))|(|))|(|))
7
(|(|))(|((|)|))(|(|))
7
(|(|)(|))(|(|((|)|)))
7
((|(|)(|))|(|))(|)(|)
...

output:

29067656
288054779
268276543
89339150
10751947
7062974440
12896948
87515230
9935467
95821402
39449302
804642817
9926719
13864876
803946127
9935359
3311681
3661747
3321749
89327362
65357799736
864265297
32255402
10747631
630052044205
96019690
89425726
38631724
89700002
784833973
90392416
28829678
893...

input:

decode
1000
7
29067656
7
288054779
7
268276543
7
89339150
7
10751947
7
7062974440
7
12896948
7
87515230
7
9935467
7
95821402
7
39449302
7
804642817
7
9926719
7
13864876
7
803946127
7
9935359
7
3311681
7
3661747
7
3321749
7
89327362
8
65357799736
7
864265297
7
32255402
7
10747631
8
630052044205
7
960...

output:

((((|)|(|)(|))|)(|)|)
(((|)(|)|)(|)(|(|))|)
(|)(|((|(|)(|))(|)|))
(|(|)(((|)|)|(|))(|))
(|)((|(|))|(|(|(|))))
((|(|)(|)(|)(|))|)(|)
(|((|)(|(|)((|)|))|))
(((|)|(|))|)((|)|)(|)
(|)(((|(|))|(|))|(|))
(|(|))(|((|)|))(|(|))
(|(|)(|))(|(|((|)|)))
((|(|)(|))|(|))(|)(|)
(|)((((|)|)|(|))|(|))
((|)|)(|(|)(((...

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 1ms
memory: 3448kb

input:

encode
1000
7
(|((|)(|)|(|))(|(|)))
7
(|(((|)|)(|((|)|))|))
7
(|)((|)((|)|)|)(|)(|)
7
(|(|))(|)(((|)(|)|)|)
7
(|(|(|((|)|(|)))))(|)
7
((|)(|(|))|(|))((|)|)
7
(|)((|)(|)|)(|(|))(|)
7
(|(((|)|(|(|)))|(|)))
7
(((|)((|)|)(|)|)|)(|)
7
((|)|)((((|)(|)|)|)|)
7
(((|)|(|)(|))|)((|)|)
7
(|(((|)(|)|)|(|(|))))
...

output:

96027428
1457237
7233283138
90290479
9938275
38632696
7260918070
1106858
778082731
3345406
38387032
10642583
784566151
345454351
28164819568
9610351
1081046
803595865
3665618
1114712
3587189
2363154710
86251606
57098
778400755
10799914
195573517537
1185983
269564297
9936458
485738
87515206
9734522
8...

input:

decode
1000
7
96027428
7
1457237
7
7233283138
7
90290479
7
9938275
7
38632696
7
7260918070
7
1106858
7
778082731
7
3345406
7
38387032
7
10642583
7
784566151
7
345454351
8
28164819568
7
9610351
7
1081046
7
803595865
7
3665618
7
1114712
7
3587189
7
2363154710
7
86251606
7
57098
7
778400755
7
10799914
...

output:

(|((|)(|)|(|))(|(|)))
(|(((|)|)(|((|)|))|))
(|)((|)((|)|)|)(|)(|)
(|(|))(|)(((|)(|)|)|)
(|(|(|((|)|(|)))))(|)
((|)(|(|))|(|))((|)|)
(|)((|)(|)|)(|(|))(|)
(|(((|)|(|(|)))|(|)))
(((|)((|)|)(|)|)|)(|)
((|)|)((((|)(|)|)|)|)
(((|)|(|)(|))|)((|)|)
(|(((|)(|)|)|(|(|))))
((|(|)((|)|))(|)|)(|)
((|)((|)|)(|)|...

result:

ok 1000 lines

Test #12:

score: 100
Accepted
time: 1ms
memory: 3488kb

input:

encode
1000
7
(|(|(|(|)(|)(|(|)))))
7
(|(|(|(|(|)))(|)))(|)
7
(|(((|)(|(|))|)|)(|))
7
(|((|)(|(|(|))(|))|))
7
(|)((|)(|)|(((|)|)|))
7
((|(|))(|)(|)(|)(|)|)
7
(((|(|))|)|)((|(|))|)
7
((|(|(|))((|)(|)|))|)
7
(|(|)(|(|(|))(|))(|))
7
(|((|)|(|)(|(|)))(|))
7
(|((|)|(|)(|)(|(|))))
7
((|)|((|)(|(|(|)))|))
...

output:

96029894
89415070
86489030
29903060
13858702
2413928102
3661603
10020302
804744029
89651918
96029786
3584177
10752676
1458509
586696637767
3245693
9568123
1462439
89405114
373418
86613280
348213919
9624184
89402330
87516518
29808590
87515204
89638078
89405864
89336302
3332441
7242525400
9607229
2981...

input:

decode
1000
7
96029894
7
89415070
7
86489030
7
29903060
7
13858702
7
2413928102
7
3661603
7
10020302
7
804744029
7
89651918
7
96029786
7
3584177
7
10752676
7
1458509
8
586696637767
7
3245693
7
9568123
7
1462439
7
89405114
7
373418
7
86613280
7
348213919
7
9624184
7
89402330
7
87516518
7
29808590
7
8...

output:

(|(|(|(|)(|)(|(|)))))
(|(|(|(|(|)))(|)))(|)
(|(((|)(|(|))|)|)(|))
(|((|)(|(|(|))(|))|))
(|)((|)(|)|(((|)|)|))
((|(|))(|)(|)(|)(|)|)
(((|(|))|)|)((|(|))|)
((|(|(|))((|)(|)|))|)
(|(|)(|(|(|))(|))(|))
(|((|)|(|)(|(|)))(|))
(|((|)|(|)(|)(|(|))))
((|)|((|)(|(|(|)))|))
(|)(((|)(|(|(|)))|)|)
((|)((|)|(|((|...

result:

ok 1000 lines

Test #13:

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

input:

encode
1000
7
(|(|((|)|))(|))((|)|)
7
((|)(|)|)(|)(|(|(|)))
7
((((|(|))|(|(|)))|)|)
8
(|)(|)(|)(|(((|)|)|)(|))
7
((((((|)|)|)|)|)|(|))
7
(((|((|)|)((|)|))|)|)
7
(|(|((|)|))(|)((|)|))
7
((|)(|)|(|((|(|))|)))
7
(|(|(|(|)(|)(|)))(|))
7
(|(|)((|)|(((|)|)|)))
7
((((|((|)(|)|))|)|)|)
7
(|(|))(|(|)(|))(|(|...

output:

38624074
870859237
131786
63141077542
1063610
474443
38624078
3674669
804650339
1541171
123767
864265405
9926573
787718239
3596015
87196408
1114715
115902761
1430918
10748599
39332974
29884552
4270408
1536803
785593507
89441086
10646501
806783011
96015814
1182986
32963020
96015694
89652346
38425786
...

input:

decode
1000
7
38624074
7
870859237
7
131786
8
63141077542
7
1063610
7
474443
7
38624078
7
3674669
7
804650339
7
1541171
7
123767
7
864265405
7
9926573
7
787718239
7
3596015
7
87196408
7
1114715
7
115902761
7
1430918
7
10748599
7
39332974
7
29884552
7
4270408
7
1536803
7
785593507
7
89441086
7
106465...

output:

(|(|((|)|))(|))((|)|)
((|)(|)|)(|)(|(|(|)))
((((|(|))|(|(|)))|)|)
(|)(|)(|)(|(((|)|)|)(|))
((((((|)|)|)|)|)|(|))
(((|((|)|)((|)|))|)|)
(|(|((|)|))(|)((|)|))
((|)(|)|(|((|(|))|)))
(|(|(|(|)(|)(|)))(|))
(|(|)((|)|(((|)|)|)))
((((|((|)(|)|))|)|)|)
(|(|))(|(|)(|))(|(|))
((|)(((|)|)|(|))|(|))
((|)(|)(|)|...

result:

ok 1000 lines

Test #14:

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

input:

encode
1000
8
(|(|((|)|)))(|(|)((|)|))
8
(|)(|(|)((|)(|)(|)|)(|))
8
(|)((|(|(|)(|))(|(|)))|)
8
(|)((|(((|)|)|))(|)|)(|)
8
(|((|)(|(|)(|(|)(|)))|))
8
(((|)|(|))(|((|)|(|)))|)
8
((|)(((|(|))(|)|)(|)|)|)
8
((|)((|)|)((|)(|)|)(|)|)
8
((|)|)(|(|(|)((|)|)(|)))
8
(|(|))(|((|)|(|((|)|))))
8
((((|)(|)(|)|(|)...

output:

348213958
572102984293
2592798505
7060179613
2428296293
30155891
784812749
21191227574
7089673741
39380641
808689797
804651272
345556838
807125980
7241574359
7284623701
812696269
9729260
347931472
7751742109
807299888
864287746
7088846177
806768476
32043260
804029188
65176500946
65176071278
86251633...

input:

decode
1000
8
348213958
8
572102984293
8
2592798505
8
7060179613
8
2428296293
8
30155891
8
784812749
8
21191227574
8
7089673741
8
39380641
8
808689797
8
804651272
8
345556838
8
807125980
8
7241574359
8
7284623701
8
812696269
8
9729260
8
347931472
8
7751742109
8
807299888
8
864287746
8
7088846177
8
8...

output:

(|(|((|)|)))(|(|)((|)|))
(|)(|(|)((|)(|)(|)|)(|))
(|)((|(|(|)(|))(|(|)))|)
(|)((|(((|)|)|))(|)|)(|)
(|((|)(|(|)(|(|)(|)))|))
(((|)|(|))(|((|)|(|)))|)
((|)(((|(|))(|)|)(|)|)|)
((|)((|)|)((|)(|)|)(|)|)
((|)|)(|(|(|)((|)|)(|)))
(|(|))(|((|)|(|((|)|))))
((((|)(|)(|)|(|)(|))|)|)
(((|)|)|((|)(|)(|)|(|)))
...

result:

ok 1000 lines

Test #15:

score: 0
Wrong Answer
time: 1ms
memory: 3556kb

input:

encode
1000
9
((|)((|((|)(|)|(|(|))))|)|)
9
((((|)(|(|))|(((|)|)|))|)|)
9
(|((|((|)(((|)|)|)|))|(|)))
9
(((((|)|)|)((|)(|)|)(|)|)|)
9
(|)(((|(|))(|(|))|)(|)|(|))
9
(|)(|((|)|)(|)(|)(|)((|)|))
9
((((|)(|(|))|)(|)|)(|(|))|)
9
(|(|))(((|)(|)|(|(|))(|))|)
9
(|(((|)|(|))|(|)((|)|))(|))
9
(((|(|)((|)(|)|)...

output:

864275936
13861421
776381915
7063738775
65118663889
2281161038767
23274322727
21797104435
7089613922
190640941952
7241551706
116202418
262832030
63573774155
6984357014
7313578841
1120322644
65125277923
586128005968
814562798
2363981402
28672448515
864601216
70539347011
5279107487755
7753062184
78814...

input:

decode
1000
9
864275936
9
13861421
9
776381915
9
7063738775
9
65118663889
9
2281161038767
9
23274322727
9
21797104435
9
7089613922
9
190640941952
9
7241551706
9
116202418
9
262832030
9
63573774155
9
6984357014
9
7313578841
9
1120322644
9
65125277923
9
586128005968
9
814562798
9
2363981402
9
28672448...

output:

((|)((|((|)(|)|(|(|))))|)|)
((((|)(|(|))|(((|)|)|))|)|)
(|((|((|)(((|)|)|)|))|(|)))
(((((|)|)|)((|)(|)|)(|)|)|)
(|)(((|(|))(|(|))|)(|)|(|))
(|)(|((|)|)(|)(|)(|)((|)|))
((((|)(|(|))|)(|)|)(|(|))|)
(|(|))(((|)(|)|(|(|))(|))|)
(|(((|)|(|))|(|)((|)|))(|))
(((|(|)((|)(|)|)(|))|)(|)|)
(|((|((|(|))|)(|)(|)...

result:

wrong answer 727th lines differ - expected: '(|)(|)(|)(|)(|)(|)(|)(|)(|)', found: '(|)(|)(|)(|)(|)(|)(|)(|)'