QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296028#4824. Bracket-and-bar Sequencesucup-team572#AC ✓45ms9564kbPython31.2kb2024-01-01 22:45:322024-01-01 22:45:34

详细

Test #1:

score: 100
Accepted
time: 10ms
memory: 9148kb

input:

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

output:

0
54
65

input:

decode
3
1
0
4
54
5
65

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

score: 100
Accepted
time: 14ms
memory: 9112kb

input:

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

output:

2
0
1

input:

decode
3
2
2
1
0
2
1

output:

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

result:

ok 3 lines

Test #4:

score: 100
Accepted
time: 20ms
memory: 9128kb

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:

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

719
615
621
628
648
654
661
669
690
696
703
711
720
616
617
618
622
623
624
625
629
630
631
632
633
649
650
651
655
662
670
656
657
658
663
664
665
666
671
672
673
674
675
691
692
693
697
698
699
700
704
712
721
705
713
722
706
707
708
714
715
716
717
723
724
725
726
727
728
729
730
731
732
733
734
...

input:

decode
1000
6
719
6
615
6
621
6
628
6
648
6
654
6
661
6
669
6
690
6
696
6
703
6
711
6
720
6
616
6
617
6
618
6
622
6
623
6
624
6
625
6
629
6
630
6
631
6
632
6
633
6
649
6
650
6
651
6
655
6
662
6
670
6
656
6
657
6
658
6
663
6
664
6
665
6
666
6
671
6
672
6
673
6
674
6
675
6
691
6
692
6
693
6
697
6
698
...

output:

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

result:

ok 1000 lines

Test #6:

score: 100
Accepted
time: 20ms
memory: 9144kb

input:

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

output:

4984
4946
2392
5362
1084
7171
5212
320
4030
779
3003
4341
157
5066
2446
3108
2626
6783
2841
4603
2989
3242
5036
7701
6272
4044
678
3313
6584
1157
7528
2252
5880
1714
3733
5492
7588
2984
6775
686
3009
832
4217
2655
2073
2037
7302
3351
1668
3288
7569
4101
4448
1671
347
7612
4899
4283
3663
6797
6945
56...

input:

decode
1000
7
4984
7
4946
7
2392
7
5362
7
1084
7
7171
7
5212
8
320
7
4030
7
779
7
3003
7
4341
8
157
7
5066
7
2446
7
3108
7
2626
7
6783
7
2841
7
4603
7
2989
7
3242
7
5036
7
7701
7
6272
7
4044
7
678
7
3313
7
6584
7
1157
7
7528
7
2252
7
5880
7
1714
7
3733
7
5492
7
7588
7
2984
7
6775
7
686
7
3009
7
832
...

output:

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

result:

ok 1000 lines

Test #7:

score: 100
Accepted
time: 20ms
memory: 9264kb

input:

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

output:

1810
6565
1606
674
3022
1076
6872
5335
525
6791
465
4741
471
62
3980
3644
1980
6859
316
659
5807
2670
5188
7675
5090
4455
3855
1527
1717
7702
4649
3744
209
6681
4788
6029
2374
4713
539
2968
587
6399
2862
2081
7632
3718
3244
6617
1334
1471
4536
519
1599
220
2021
7593
6750
4749
630
2142
4506
5044
288
...

input:

decode
1000
7
1810
7
6565
7
1606
7
674
7
3022
7
1076
7
6872
7
5335
7
525
7
6791
7
465
7
4741
8
471
8
62
7
3980
7
3644
7
1980
7
6859
8
316
8
659
7
5807
7
2670
7
5188
7
7675
7
5090
7
4455
7
3855
7
1527
7
1717
7
7702
7
4649
7
3744
7
209
7
6681
7
4788
7
6029
7
2374
7
4713
7
539
7
2968
7
587
7
6399
7
286...

output:

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

result:

ok 1000 lines

Test #8:

score: 100
Accepted
time: 26ms
memory: 9204kb

input:

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

output:

6667
426
3987
2202
6798
5294
3522
5280
63
2239
7611
1603
3927
7420
6350
1047
2264
7044
5246
6986
3786
3928
3056
3166
683
7722
414
5342
1412
3329
1895
4385
1986
7154
4058
423
4586
4768
6760
7213
2048
4244
7004
2333
7674
883
4142
3656
2371
4236
6297
3131
3150
3392
2047
7731
3113
4909
7082
4201
884
638...

input:

decode
1000
7
6667
7
426
7
3987
7
2202
7
6798
7
5294
7
3522
7
5280
8
63
7
2239
7
7611
7
1603
7
3927
7
7420
7
6350
7
1047
7
2264
7
7044
7
5246
7
6986
7
3786
7
3928
7
3056
7
3166
7
683
7
7722
7
414
7
5342
7
1412
7
3329
7
1895
7
4385
7
1986
7
7154
7
4058
8
423
7
4586
7
4768
7
6760
7
7213
7
2048
7
4244
...

output:

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

result:

ok 1000 lines

Test #9:

score: 100
Accepted
time: 18ms
memory: 9064kb

input:

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

output:

5667
1649
522
333
3857
7026
5541
7121
1499
6975
5742
1037
7533
1587
5780
6498
1039
4936
5846
583
3401
1398
3057
232
5794
2289
1371
5061
915
1315
718
2467
7736
1721
81
6600
1293
3263
919
5582
6871
202
4606
4722
2057
5649
6619
5902
3693
5153
2660
2816
4632
2420
42
4501
2050
6337
203
906
1843
1559
280
...

input:

decode
1000
7
5667
7
1649
7
522
8
333
7
3857
7
7026
7
5541
7
7121
7
1499
7
6975
7
5742
7
1037
7
7533
7
1587
7
5780
7
6498
7
1039
7
4936
7
5846
8
583
7
3401
7
1398
7
3057
8
232
7
5794
7
2289
7
1371
7
5061
7
915
7
1315
8
718
7
2467
7
7736
7
1721
8
81
7
6600
7
1293
7
3263
7
919
7
5582
7
6871
8
202
7
46...

output:

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

result:

ok 1000 lines

Test #10:

score: 100
Accepted
time: 21ms
memory: 9148kb

input:

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

output:

7501
6819
655
2112
1023
5644
3241
6604
1326
1539
1724
5589
1378
3960
1626
2753
7220
3566
2778
4510
162
3944
4923
3578
72
2612
4087
5461
5597
5683
1509
7570
3090
5137
7392
3734
4479
488
7115
3499
856
650
1825
7166
5170
6107
3294
6449
292
5658
1058
2130
3900
1022
3423
2216
649
4469
1574
3203
2066
7678...

input:

decode
1000
7
7501
7
6819
7
655
7
2112
7
1023
7
5644
7
3241
7
6604
7
1326
7
1539
7
1724
7
5589
7
1378
7
3960
7
1626
7
2753
7
7220
7
3566
7
2778
7
4510
8
162
7
3944
7
4923
7
3578
8
72
7
2612
7
4087
7
5461
7
5597
7
5683
7
1509
7
7570
7
3090
7
5137
7
7392
7
3734
7
4479
7
488
7
7115
7
3499
7
856
7
650
7...

output:

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

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 22ms
memory: 9156kb

input:

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

output:

3164
3635
959
1480
2577
4891
874
3671
6979
4146
6654
3696
5714
5091
179
6228
2786
5241
6907
7021
4996
4797
7465
3685
5172
262
212
6217
5162
7245
6027
6803
5572
3844
4888
4131
401
6369
2254
2321
3079
1984
2017
3067
1211
3746
4402
1308
2938
1152
5063
3159
952
6486
1107
6288
567
229
4835
5097
6124
3444...

input:

decode
1000
7
3164
7
3635
7
959
7
1480
7
2577
7
4891
7
874
7
3671
7
6979
7
4146
7
6654
7
3696
7
5714
7
5091
8
179
7
6228
7
2786
7
5241
7
6907
7
7021
7
4996
7
4797
7
7465
7
3685
7
5172
7
262
8
212
7
6217
7
5162
7
7245
7
6027
7
6803
7
5572
7
3844
7
4888
7
4131
7
401
7
6369
7
2254
7
2321
7
3079
7
1984
...

output:

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

result:

ok 1000 lines

Test #12:

score: 100
Accepted
time: 21ms
memory: 9144kb

input:

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

output:

2500
2524
3720
3246
900
5486
7034
5844
1907
3042
3039
4500
1302
5138
158
5571
7739
2094
5797
4418
1564
746
1421
3590
5108
5217
6828
7027
4485
4383
2598
358
6292
5028
3160
443
1891
7704
7373
2541
1430
3959
5481
6052
2372
3910
7028
4365
2207
6497
6703
4269
6894
186
5600
7224
1543
7041
5468
1182
296
38...

input:

decode
1000
7
2500
7
2524
7
3720
7
3246
7
900
7
5486
7
7034
7
5844
7
1907
7
3042
7
3039
7
4500
7
1302
7
5138
8
158
7
5571
7
7739
7
2094
7
5797
7
4418
7
1564
7
746
7
1421
7
3590
7
5108
7
5217
7
6828
7
7027
7
4485
7
4383
7
2598
7
358
7
6292
7
5028
7
3160
7
443
7
1891
7
7704
7
7373
7
2541
7
1430
7
3959...

output:

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

result:

ok 1000 lines

Test #13:

score: 100
Accepted
time: 21ms
memory: 9128kb

input:

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

output:

2625
4609
7620
136
7740
7301
2629
4712
2497
2028
7661
1496
5254
4771
2418
7406
3126
4949
7567
3316
1189
1299
1389
6808
944
4182
5540
566
3569
5946
5457
6005
1075
1934
3115
1516
5390
3747
364
897
3099
2627
1512
5276
456
6231
1029
7729
3095
1963
127
255
765
6818
1641
357
1961
6327
4085
355
2045
6455
6...

input:

decode
1000
7
2625
7
4609
7
7620
8
136
7
7740
7
7301
7
2629
7
4712
7
2497
7
2028
7
7661
7
1496
7
5254
7
4771
7
2418
7
7406
7
3126
7
4949
7
7567
7
3316
7
1189
7
1299
7
1389
7
6808
7
944
7
4182
7
5540
7
566
7
3569
7
5946
7
5457
7
6005
7
1075
7
1934
7
3115
7
1516
7
5390
7
3747
8
364
7
897
7
3099
7
2627...

output:

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

result:

ok 1000 lines

Test #14:

score: 100
Accepted
time: 23ms
memory: 9248kb

input:

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

output:

14094
2042
5863
6256
17505
36539
28944
27893
21784
8345
41930
35499
19747
2542
17701
21868
1568
35553
13070
28473
31681
4457
10388
39234
11603
3500
5371
26963
42808
2469
13473
26215
13215
43162
31429
14802
19077
31891
19835
29396
7454
8424
17498
23359
4228
35040
4448
25960
17930
29835
795
22640
4148...

input:

decode
1000
8
14094
8
2042
8
5863
8
6256
8
17505
8
36539
8
28944
8
27893
8
21784
8
8345
8
41930
8
35499
8
19747
8
2542
8
17701
8
21868
8
1568
8
35553
8
13070
8
28473
8
31681
8
4457
8
10388
8
39234
8
11603
8
3500
8
5371
8
26963
8
42808
8
2469
8
13473
8
26215
8
13215
8
43162
8
31429
8
14802
8
19077
8
...

output:

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

result:

ok 1000 lines

Test #15:

score: 100
Accepted
time: 23ms
memory: 9260kb

input:

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

output:

160648
238159
107323
243114
39353
15850
238076
50118
111111
224608
107442
65987
225541
219428
114159
59765
82489
136437
13459
147738
97663
159641
38628
233189
25740
24116
200693
221935
41500
137558
239930
93184
103827
165386
1131
116770
41471
108852
50908
14300
71957
83800
165878
167555
193935
96761...

input:

decode
1000
9
160648
9
238159
9
107323
9
243114
9
39353
9
15850
9
238076
9
50118
9
111111
9
224608
9
107442
9
65987
9
225541
9
219428
9
114159
9
59765
9
82489
9
136437
9
13459
9
147738
9
97663
9
159641
9
38628
9
233189
9
25740
9
24116
9
200693
9
221935
9
41500
9
137558
9
239930
9
93184
9
103827
9
16...

output:

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

result:

ok 1000 lines

Test #16:

score: 100
Accepted
time: 21ms
memory: 9212kb

input:

encode
1000
10
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
10
((((((((((|)|)|)|)|)|)|)|)|)|)
10
(|(|(|(|(|(|(|(|(|(|))))))))))
10
((|)|)((|)|(((|)|)|)(|((|)|)))
10
(|)((|)|((|((|)(|((|)|))|))|))
10
(|)(((|)|)((|(|))((|)|)(|)|)|)
10
((|)(|((|)|))(|)((|(|))|(|))|)
10
(((((((|(|(|)))|)|)|)(|)|)|)|)
10
(((|)|((|)|))...

output:

0
1430714
428881
715587
139380
204236
877060
1430499
1199922
282509
775023
837644
425156
217468
529684
500317
500503
319622
782659
1194081
332319
856282
1191093
1011880
24431
1279798
1257062
776002
1309341
1407336
890647
57596
1371306
466574
214372
1292916
814445
485428
403417
369812
438019
1148767
...

input:

decode
1000
10
0
10
1430714
10
428881
10
715587
10
139380
10
204236
10
877060
10
1430499
10
1199922
10
282509
10
775023
10
837644
10
425156
10
217468
10
529684
10
500317
10
500503
10
319622
10
782659
10
1194081
10
332319
10
856282
10
1191093
10
1011880
10
24431
10
1279798
10
1257062
10
776002
10
130...

output:

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

result:

ok 1000 lines

Test #17:

score: 100
Accepted
time: 22ms
memory: 9232kb

input:

encode
1000
11
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
11
(((((((((((|)|)|)|)|)|)|)|)|)|)|)
11
(|(|(|(|(|(|(|(|(|(|(|)))))))))))
11
((|)|)((|(|))(|)(|)(|)|((|)(|)|))
11
(|((((|)|)|)|((|(|(((|)|)|)))|)))
11
((|)|(((|)|(|((|((|)|))|)(|)))|))
11
(((|)|)|)((|(|)(((|)|)|))(|(|))|)
11
((|)((|)|)|((|)((|)|)|(|(|...

output:

0
8414639
2474572
4200227
3904733
4671135
6664768
5184398
5756039
4621902
1947037
4470332
7720674
1311566
6248445
3360924
1732206
1095882
5118389
1385331
2233050
7269165
7083657
1489658
3384209
7926201
8054174
8299052
531861
4599784
5848256
6333870
2360620
2757117
8197784
317068
4611262
459807
15406...

input:

decode
1000
11
0
11
8414639
11
2474572
11
4200227
11
3904733
11
4671135
11
6664768
11
5184398
11
5756039
11
4621902
11
1947037
11
4470332
11
7720674
11
1311566
11
6248445
11
3360924
11
1732206
11
1095882
11
5118389
11
1385331
11
2233050
11
7269165
11
7083657
11
1489658
11
3384209
11
7926201
11
80541...

output:

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

result:

ok 1000 lines

Test #18:

score: 100
Accepted
time: 32ms
memory: 9116kb

input:

encode
1000
12
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
12
((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)
12
(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))
12
((|)|)((|)(|(|))(|(|))(|)((|)(|)|)|)
12
(((|(|((|)|))(|))(|)|)|)(((|)|)|(|))
12
((|)|)(|(|)((|(|((|)(|)|)))(|(|))|))
12
((|(|((|)|(|))(|)((|)|)(|)(|)(|)))|)
12
(|((|...

output:

0
50067107
14492345
24701107
45276532
24193812
36171649
19102379
27189696
24578751
45908534
10903227
9937426
4372940
41989264
5519957
288132
22586138
46551633
15516636
36355609
31925480
14540002
8588234
46370617
32038230
33713946
37208939
46252751
25096339
9730401
38218066
6322499
26074149
1722880
1...

input:

decode
1000
12
0
12
50067107
12
14492345
12
24701107
12
45276532
12
24193812
12
36171649
12
19102379
12
27189696
12
24578751
12
45908534
12
10903227
12
9937426
12
4372940
12
41989264
12
5519957
12
288132
12
22586138
12
46551633
12
15516636
12
36355609
12
31925480
12
14540002
12
8588234
12
46370617
1...

output:

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

result:

ok 1000 lines

Test #19:

score: 100
Accepted
time: 22ms
memory: 9188kb

input:

encode
1000
13
(((|)|(|((|)|)(|))(|)((|)|))(|((|)|))|)
13
(|((|)((|)|)((((|)|)((|)|)|)(|)|(|))|))
13
(|(|(|(|))(|)(|)(|(|((|)|)))(|(|))))(|)
13
((|(((|)|)(|(|))|((|)|(|))))((|(|))|)|)
13
(|)(((((|)|)|)(|)(|)(|(((|)|)|(|)))|)|)
13
((|((|)(|)(|)((|)|)|))|)(|)(|((|)(|)|))
13
(|(|)(|)((|(|(|(|)))(|))(|(...

output:

247203640
113372048
83166673
230547714
49004035
224090193
61950186
20298747
84299701
238394075
294176752
101415750
82507932
40949652
177867504
168513533
47610246
61205760
221578259
152412258
109148101
70550086
238723037
53736265
192018312
55227083
187496289
88573338
263539269
54370936
284274837
7333...

input:

decode
1000
13
247203640
13
113372048
13
83166673
13
230547714
13
49004035
13
224090193
13
61950186
13
20298747
13
84299701
13
238394075
13
294176752
13
101415750
13
82507932
13
40949652
13
177867504
13
168513533
13
47610246
13
61205760
13
221578259
13
152412258
13
109148101
13
70550086
13
238723037...

output:

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

result:

ok 1000 lines

Test #20:

score: 100
Accepted
time: 30ms
memory: 9184kb

input:

encode
1000
14
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
14
((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)
14
(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))
14
((|)|(|))(|((|)|))((|)((|)|(|)(|(|)))(|)|)
14
(|((|)|(|)((((|)|)|)(|)(|)|(|(((|)|)|)))))
14
(((|)|(|))|(|(|)(|))(|(|)))(|(((|)|(|))|))
14
(|)(|)(|(...

output:

0
1822766519
514763278
912472448
633753500
1470521723
10631775
1507400220
1588365893
1368125063
657890398
1503131402
473009120
1755690809
672441358
558595252
698512483
1631312488
543825440
697629850
133818042
961269104
47958486
1131536312
89895995
422331982
602261758
1000862833
1269103653
673913475
...

input:

decode
1000
14
0
14
1822766519
14
514763278
14
912472448
14
633753500
14
1470521723
14
10631775
14
1507400220
14
1588365893
14
1368125063
14
657890398
14
1503131402
14
473009120
14
1755690809
14
672441358
14
558595252
14
698512483
14
1631312488
14
543825440
14
697629850
14
133818042
14
961269104
14
...

output:

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

result:

ok 1000 lines

Test #21:

score: 100
Accepted
time: 29ms
memory: 9288kb

input:

encode
1000
15
((|(|))|(|(|((|((|)(|)|)(|(|)))|)))((|)|(|)))
15
(|)(|)(|(|(|)(|((|)(|((|)|))|)(|)))((|)(|)|))
15
((|)|)((|)(|)(|(|(|)(|)(|))((|)|))(|)|(|(|)))
15
(|(|)((|)|(((|)|)(|)(|)(|)|(|)))((|)|))((|)|)
15
((|(|(|)((|)|)((|)|((|(|))(|)|))))|)(|(|))(|)
15
(|)((|)|(|(|)))(((|)((|)|)|)|(|(|)(|((|)...

output:

7136415650
80283496
5397603582
2471244217
7745473060
934670237
973897969
4769529737
6975490163
8544189488
5299538266
9319602379
5218886789
4781682686
8762831023
7403971569
4463957756
7261235665
4406250190
9326757411
5326433760
1460995189
8119563870
7986676122
6134309793
9251659832
8915628061
6317777...

input:

decode
1000
15
7136415650
15
80283496
15
5397603582
15
2471244217
15
7745473060
15
934670237
15
973897969
15
4769529737
15
6975490163
15
8544189488
15
5299538266
15
9319602379
15
5218886789
15
4781682686
15
8762831023
15
7403971569
15
4463957756
15
7261235665
15
4406250190
15
9326757411
15
532643376...

output:

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

result:

ok 1000 lines

Test #22:

score: 100
Accepted
time: 29ms
memory: 9368kb

input:

encode
1000
16
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
16
((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
16
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))
16
((|)|(|(|)))(|)((|)(|(|(|(|))))((|)|(|))(|(|))|)
16
((((|)|)(|)|(|)(|)(|(|)((|)((|)|)|))(|))(|)|(|))
16
(|(|))(|((|)|(|((|)(|(|(|...

output:

0
68328754958
18946375766
34671024459
63195910812
11764043793
26578609095
58575535866
34723589327
53095083796
26893279522
16915928548
47266681896
68030676614
142602494
42824842009
49990691359
14903098528
6188426508
12300710796
41449154437
24765740208
48470227340
14237964161
48173641107
7687555967
26...

input:

decode
1000
16
0
16
68328754958
16
18946375766
16
34671024459
16
63195910812
16
11764043793
16
26578609095
16
58575535866
16
34723589327
16
53095083796
16
26893279522
16
16915928548
16
47266681896
16
68030676614
16
142602494
16
42824842009
16
49990691359
16
14903098528
16
6188426508
16
12300710796
1...

output:

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

result:

ok 1000 lines

Test #23:

score: 100
Accepted
time: 30ms
memory: 9204kb

input:

encode
1000
17
(((((|)(|(((|)|)|))|((|)|))(|(|(|))(|))|(|(|)))|)|)
17
((|((|((|((|)|))|(|)))|))|(|(((|)|)|)((|)|))((|)|))
17
((|)(|)|)(|)((|(|(|)((|(|))|))(|(|)((|)(|)|)))(|)|)
17
((((|)|)((|(|((|(((|)|)(|)|))|)(|(|)(|))(|)))|)|)|)
17
(((|)|)|(|(|((|(|(|(|))(|)(|)))((|)(|)|)|)((|)|))))
17
(|(|(((|)|...

output:

414945513501
316419184885
229143331764
391386443199
328764009582
131536073045
396215505761
173476017159
98363511782
130741847444
377315729282
343339625083
130833961899
223381765963
99746785408
22306733390
69805102534
202141302834
87914432307
117343786097
98363462796
372944297472
262785228790
3417380...

input:

decode
1000
17
414945513501
17
316419184885
17
229143331764
17
391386443199
17
328764009582
17
131536073045
17
396215505761
17
173476017159
17
98363511782
17
130741847444
17
377315729282
17
343339625083
17
130833961899
17
223381765963
17
99746785408
17
22306733390
17
69805102534
17
202141302834
17
8...

output:

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

result:

ok 1000 lines

Test #24:

score: 100
Accepted
time: 39ms
memory: 9324kb

input:

encode
1000
18
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
18
((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
18
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|))))))))))))))))))
18
((|)|((|(|))|(|)))(((|)|)((|)|)|)((|)|)(|(|))((|)|)(|)
18
((|)((|)|(|((|)|))((|(|))((|)(((|)|)|((|)|))|(|))|))|...

output:

0
2619631042664
716179441292
1377615702861
1560957169163
2035257576223
574855813725
2435480039031
1163163027585
1205901484094
520412179155
598895596242
864246846523
469960045163
843079454483
1584660690641
2438487534551
908588346445
1778532398522
610359138255
303851297629
1405138871632
685507227278
6...

input:

decode
1000
18
0
18
2619631042664
18
716179441292
18
1377615702861
18
1560957169163
18
2035257576223
18
574855813725
18
2435480039031
18
1163163027585
18
1205901484094
18
520412179155
18
598895596242
18
864246846523
18
469960045163
18
843079454483
18
1584660690641
18
2438487534551
18
908588346445
18...

output:

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

result:

ok 1000 lines

Test #25:

score: 100
Accepted
time: 39ms
memory: 9420kb

input:

encode
1000
19
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
19
(((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
19
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))
19
((|)|((|(|))|)((|)|(|)))(|)(|(((|)(|)(|)|(|(|))(|))|))(|)
19
(|((((|)(|)|)|)((|(((|)|)(|)|))|)|((|)|)(...

output:

0
16332922290299
4438862153245
8559611093465
7342600464166
5300463572728
4545269560031
15194131279711
6461766310620
5875177160228
10000413858263
10798402860034
1460534130468
12034763997761
15960158411040
13987977352518
14747880510885
1350031204318
7179008033336
2108545467089
13186598343811
846865446...

input:

decode
1000
19
0
19
16332922290299
19
4438862153245
19
8559611093465
19
7342600464166
19
5300463572728
19
4545269560031
19
15194131279711
19
6461766310620
19
5875177160228
19
10000413858263
19
10798402860034
19
1460534130468
19
12034763997761
19
15960158411040
19
13987977352518
19
14747880510885
19
...

output:

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

result:

ok 1000 lines

Test #26:

score: 100
Accepted
time: 42ms
memory: 9308kb

input:

encode
1000
20
(|(|(|)))(|((|)|(((|(|(|)))|(|(|))(|(|)))(|)|)(|(|))(|)))(|)
20
((|)|)((((|)|(|))|((|((|)(|)|))(((|)|)(|)(((|(|))|)|)|)|))|)
20
(((((|)|)((((|)|)|)|((((|(|)(|(|)))|)|(|))|))(|)|(|(|)))|)|)
20
(((|((|)|(|))((((|(|)((|(|))(|)((|(|))|)|))|)|)|(|))(|))|)|)
20
((|)((|)(((|(|(|((|)|))))|)|)...

output:

24063439588815
49796486826520
99644324388456
91369221569999
61281622940284
50335586037253
26395914530035
100757944043561
89896998265062
49984487506482
90591858036712
76395983128331
26999857444169
41278170051164
18361784949089
32843052933511
3353578304086
57562160991980
18759818895558
64572090540149
...

input:

decode
1000
20
24063439588815
20
49796486826520
20
99644324388456
20
91369221569999
20
61281622940284
20
50335586037253
20
26395914530035
20
100757944043561
20
89896998265062
20
49984487506482
20
90591858036712
20
76395983128331
20
26999857444169
20
41278170051164
20
18361784949089
20
32843052933511...

output:

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

result:

ok 1000 lines

Test #27:

score: 100
Accepted
time: 38ms
memory: 9384kb

input:

encode
1000
21
(((|((|(|)(|)(|(|)(|))(|))|))(|(|))|)(|(|))|(((|)|)|(|((|)|))))
21
((|)(|)(|)|(|((|(|)(|((|)|))(|)(|))(|(|)(|)(((|)|(|))(|)|))|)))
21
((|(|(|))(|)((|)|(|)))(|)|(((|)|)|(|(|(|)(|)(((|)(|)|)|)))))(|)
21
(|((|)(|(|))((|)|)(|)(|)((((|)|)|(|)(|))|)|))((|(|((|)|)))(|)|)
21
(|)((|)(|)|(|((((...

output:

577528877794380
352723862461229
433544428988589
226437264527598
55789838562519
603935410706352
398220817672189
244579958284018
495452236859390
77453811554539
233438515972952
83643291538344
297653266540885
541694738629167
517760828991080
215210535676096
12057168082045
16105581810431
276709843932436
1...

input:

decode
1000
21
577528877794380
21
352723862461229
21
433544428988589
21
226437264527598
21
55789838562519
21
603935410706352
21
398220817672189
21
244579958284018
21
495452236859390
21
77453811554539
21
233438515972952
21
83643291538344
21
297653266540885
21
541694738629167
21
517760828991080
21
215...

output:

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

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 45ms
memory: 9524kb

input:

encode
1000
22
(|((|)|(|(|(((|)(|)(|)|)((|)(((|)|)|)|)(|)|)))(|(|)))(|(((|)|)|)))
22
((|(|(|)))|(|)(|)((|)|))(((|)|)(|((((|)|)|)|))|(|))((((|)(|)|)|)|)
22
((|(|((|(|))|)))(|(|(|)((|((|((((|)|)|(|))|(|)(|)))|)(|))|)))(|)|)
22
((|)(|((|(|(|(|(|)(|(|)))))(|)(|))(((|)|)|(|))(|((|)|)(|))|))(|)|)
22
(((|)...

output:

1356750479887520
2708780606654679
2822237585647833
2342345645812570
3428900444360306
2739262538939717
3408683062189305
1056391621870602
3476528262071380
924269912901855
3416926655251254
319817240976994
2871556231412348
781071555973443
2821917783252143
2817118532442363
539588994280139
107290972975965...

input:

decode
1000
22
1356750479887520
22
2708780606654679
22
2822237585647833
22
2342345645812570
22
3428900444360306
22
2739262538939717
22
3408683062189305
22
1056391621870602
22
3476528262071380
22
924269912901855
22
3416926655251254
22
319817240976994
22
2871556231412348
22
781071555973443
22
28219177...

output:

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

result:

ok 1000 lines

Test #29:

score: 100
Accepted
time: 40ms
memory: 9444kb

input:

encode
1000
23
((|)((|)|)(|((|(|(|(|(|))((|)((|)((|)|(|))(|((|(|))(|)|))|)|))))|))|)
23
(|(|)((|)|(|)))(|((|(|(((|((|)|)(|))|)|)))|)((|(|))(|)|(|(|)(|)(|))))
23
(|(|))((((|)|)(|)|(((|(|))|)(|)|))(|((|(|)(|))(|)|(|((|)|)(|))(|)))|)
23
(((|((|)((|(|))(|)|(|))|))((|)|(|(|)(|(|)((|)|(|)))))((|)|(|)(|))|...

output:

14963864949084167
5381537276104384
4638476078809392
22896244217463273
23760971063123134
18199143730898258
20890298192760121
18214648249233219
23774070962579362
14542693344357817
13700517903336700
21404088098083409
20061155148715068
8980611411360526
8782020674040358
5160194643193845
16857834585050092...

input:

decode
1000
23
14963864949084167
23
5381537276104384
23
4638476078809392
23
22896244217463273
23
23760971063123134
23
18199143730898258
23
20890298192760121
23
18214648249233219
23
23774070962579362
23
14542693344357817
23
13700517903336700
23
21404088098083409
23
20061155148715068
23
89806114113605...

output:

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

result:

ok 1000 lines

Test #30:

score: 100
Accepted
time: 38ms
memory: 9464kb

input:

encode
1000
24
(|((((|)|)|)|)(|)(((|)|((|)(|(|))|))|(|))((|(|)(|))|(|(((|)|)|))((|)|)))
24
(|)(|(|)(|((|(|))|))(|)(|((|)((|)|)((|)|)|(((|)|)|)))(|((|)|(|(|))(|))))
24
(|(|((((|)|)(|)(|)((|(|))(|)|)|(|))|((((|(|(|))(|))|)|)|))(|(|)))(|)(|))
24
(|((|(|))|(((|)(|)|)|((|(|(|)((|(|))(|)(|)|(|))))|)((|)((...

output:

71068804302715713
5237976494737668
50456602082364586
59533447774455672
136825924510943640
90966337942507867
57040127912362442
48662722855503612
135127488870792721
59812490665705316
138338133631294777
106138284864219393
125918390119173918
75577607935740794
134099996311774564
63483094974378478
1153377...

input:

decode
1000
24
71068804302715713
24
5237976494737668
24
50456602082364586
24
59533447774455672
24
136825924510943640
24
90966337942507867
24
57040127912362442
24
48662722855503612
24
135127488870792721
24
59812490665705316
24
138338133631294777
24
106138284864219393
24
125918390119173918
24
75577607...

output:

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

result:

ok 1000 lines

Test #31:

score: 100
Accepted
time: 41ms
memory: 9564kb

input:

encode
1000
25
(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)(|)
25
(((((((((((((((((((((((((|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)|)
25
(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|(|)))))))))))))))))))))))))
25
((|)|((((|(|((|)|(|)(|))))|)|)(((|)(|)((|)|)|(|)...

output:

0
1031147983159782227
273204023401012900
546849837249385952
857727073651778664
667175582989985766
66587441458768449
183753979107287749
955375749532390110
108400384817689942
318210619369294458
205855035545111747
923356590486576125
515157064124907992
675990295460369622
552445690585586934
7316639704207...

input:

decode
1000
25
0
25
1031147983159782227
25
273204023401012900
25
546849837249385952
25
857727073651778664
25
667175582989985766
25
66587441458768449
25
183753979107287749
25
955375749532390110
25
108400384817689942
25
318210619369294458
25
205855035545111747
25
923356590486576125
25
5151570641249079...

output:

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

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 43ms
memory: 9492kb

input:

encode
1000
25
(|)(((|(|(|(|))))|(|((|)(|)|)(|(|(|(|(|))))))(|))|(|((|)|)(|((|)|)((|)|))))
25
((|)(|(|((((|)|)|)|((|)|)(|))((((|(|))|)|)((|)|)|)(|(|(|)))))|(|(|)(|(|))))
22
(|(|(|(|((((|)|)|)(((|(((|)|)|))|(((|)|)|)(|))(|(|(|(|))))|)|)))))
24
((|(|))|(|(((|)(|)|(|))(((|)(|)|)(((|)|)(|)|((|)(|)|))(|)...

output:

142181439767992872
587548959569668546
1095476707489706
101487606781100297
100173794466758684
4026136523686443
371631460853206
39729084482380
57756487577974
8071484798713974
12908055668737619
61994075925656556
189029617050047734
1008062407059049187
13066813293205484
40978678988122259
0
10495084628729...

input:

decode
1000
25
142181439767992872
25
587548959569668546
22
1095476707489706
24
101487606781100297
24
100173794466758684
23
4026136523686443
21
371631460853206
20
39729084482380
20
57756487577974
23
8071484798713974
23
12908055668737619
24
61994075925656556
25
189029617050047734
25
100806240705904918...

output:

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

result:

ok 1000 lines