QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#296314#4824. Bracket-and-bar Sequencesucup-team1378AC ✓1333ms3932kbC++175.5kb2024-01-02 18:45:482024-01-02 18:45:48

详细

Test #1:

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

input:

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

output:

0
54
73

input:

decode
3
1
0
4
54
5
73

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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: 51ms
memory: 3588kb

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

score: 100
Accepted
time: 64ms
memory: 3808kb

input:

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

output:

829
886
895
899
905
931
940
944
912
959
949
963
968
885
887
888
889
894
896
897
890
900
898
901
902
904
906
907
903
908
909
930
932
933
934
939
941
942
935
945
943
946
947
911
913
914
915
958
960
961
910
916
917
950
964
969
948
951
952
953
962
965
966
954
970
967
971
972
518
519
520
521
523
524
525
...

input:

decode
1000
6
829
6
886
6
895
6
899
6
905
6
931
6
940
6
944
6
912
6
959
6
949
6
963
6
968
6
885
6
887
6
888
6
889
6
894
6
896
6
897
6
890
6
900
6
898
6
901
6
902
6
904
6
906
6
907
6
903
6
908
6
909
6
930
6
932
6
933
6
934
6
939
6
941
6
942
6
935
6
945
6
943
6
946
6
947
6
911
6
913
6
914
6
915
6
958
...

output:

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

result:

ok 1000 lines

Test #6:

score: 100
Accepted
time: 84ms
memory: 3648kb

input:

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

output:

5587
5392
4177
3440
1215
7453
5658
374
2964
570
2334
6384
112
2655
4265
5069
1664
3571
4829
6596
4442
2235
5606
7244
7032
3078
450
2365
6147
1274
3816
4228
3468
1494
5180
5831
7602
1716
7437
956
2339
1172
3131
4676
4114
3968
3810
5120
1959
4914
7591
3065
6430
1875
277
7282
5580
6373
4552
7096
7140
6...

input:

decode
1000
7
5587
7
5392
7
4177
7
3440
7
1215
7
7453
7
5658
8
374
7
2964
7
570
7
2334
7
6384
8
112
7
2655
7
4265
7
5069
7
1664
7
3571
7
4829
7
6596
7
4442
7
2235
7
5606
7
7244
7
7032
7
3078
7
450
7
2365
7
6147
7
1274
7
3816
7
4228
7
3468
7
1494
7
5180
7
5831
7
7602
7
1716
7
7437
7
956
7
2339
7
1172...

output:

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

result:

ok 1000 lines

Test #7:

score: 100
Accepted
time: 86ms
memory: 3648kb

input:

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

output:

3912
6107
1940
946
4464
1066
7060
3394
868
3579
760
5537
401
67
3003
2425
1584
3590
372
445
2754
4311
5653
6318
2503
3178
5292
1906
1505
7616
2557
4562
207
7367
5307
6968
4592
5522
854
1714
920
7300
2273
3991
7678
5178
4904
7388
1326
1795
6444
873
1976
239
4101
7685
7427
2459
900
4129
6524
5620
337
...

input:

decode
1000
7
3912
7
6107
7
1940
7
946
7
4464
7
1066
7
7060
7
3394
7
868
7
3579
7
760
7
5537
8
401
8
67
7
3003
7
2425
7
1584
7
3590
8
372
8
445
7
2754
7
4311
7
5653
7
6318
7
2503
7
3178
7
5292
7
1906
7
1505
7
7616
7
2557
7
4562
7
207
7
7367
7
5307
7
6968
7
4592
7
5522
7
854
7
1714
7
920
7
7300
7
227...

output:

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

result:

ok 1000 lines

Test #8:

score: 100
Accepted
time: 83ms
memory: 3892kb

input:

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

output:

7352
398
2939
2121
3582
5753
5116
5726
72
4211
7279
1839
2908
7638
3665
1081
4236
7485
5735
3605
5251
2906
2344
2224
451
7612
753
3412
1418
4493
4015
6407
1472
3762
3041
392
6452
5342
3759
2842
3969
6350
7170
4150
6317
477
3073
2263
4603
3152
7022
2214
4345
4380
1573
7295
4480
2494
3793
3231
478
369...

input:

decode
1000
7
7352
7
398
7
2939
7
2121
7
3582
7
5753
7
5116
7
5726
8
72
7
4211
7
7279
7
1839
7
2908
7
7638
7
3665
7
1081
7
4236
7
7485
7
5735
7
3605
7
5251
7
2906
7
2344
7
2224
7
451
7
7612
7
753
7
3412
7
1418
7
4493
7
4015
7
6407
7
1472
7
3762
7
3041
8
392
7
6452
7
5342
7
3759
7
2842
7
3969
7
6350
...

output:

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

result:

ok 1000 lines

Test #9:

score: 100
Accepted
time: 82ms
memory: 3656kb

input:

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

output:

3341
1989
406
287
5293
3773
5894
6058
1878
6052
5799
1078
2844
1966
6872
2783
1071
5547
6711
434
2357
691
1725
124
5926
4249
1405
2653
977
686
454
4183
7737
1508
139
3731
1298
4366
461
3326
7059
236
2513
5508
4066
6600
7391
6714
2400
5638
4197
4789
2546
2053
23
6521
4065
3645
237
980
3930
1919
329
3...

input:

decode
1000
7
3341
7
1989
7
406
8
287
7
5293
7
3773
7
5894
7
6058
7
1878
7
6052
7
5799
7
1078
7
2844
7
1966
7
6872
7
2783
7
1071
7
5547
7
6711
8
434
7
2357
7
691
7
1725
8
124
7
5926
7
4249
7
1405
7
2653
7
977
7
686
8
454
7
4183
7
7737
7
1508
8
139
7
3731
7
1298
7
4366
7
461
7
3326
7
7059
8
236
7
251...

output:

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

result:

ok 1000 lines

Test #10:

score: 100
Accepted
time: 80ms
memory: 3600kb

input:

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

output:

6297
6016
903
4002
1249
3311
4897
3732
1381
1831
1512
3333
1407
2997
1864
2192
6249
2416
4784
3297
113
2913
5412
4540
131
2171
3087
2729
6633
3338
1887
6268
1726
5694
2851
5196
3272
857
3613
4519
604
906
3914
3766
5632
6756
4927
7334
341
6611
609
3998
2873
1248
5089
1635
904
6549
1848
4336
3992
6319...

input:

decode
1000
7
6297
7
6016
7
903
7
4002
7
1249
7
3311
7
4897
7
3732
7
1381
7
1831
7
1512
7
3333
7
1407
7
2997
7
1864
7
2192
7
6249
7
2416
7
4784
7
3297
8
113
7
2913
7
5412
7
4540
8
131
7
2171
7
3087
7
2729
7
6633
7
3338
7
1887
7
6268
7
1726
7
5694
7
2851
7
5196
7
3272
7
857
7
3613
7
4519
7
604
7
906
...

output:

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

result:

ok 1000 lines

Test #11:

score: 100
Accepted
time: 85ms
memory: 3812kb

input:

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

output:

4354
5001
490
1798
2158
2623
467
5238
3565
3123
3722
5182
2702
2504
193
3545
4820
2685
7075
7175
5597
5309
3627
5245
2647
265
203
6951
5639
7512
6971
3583
5891
4567
2619
3108
304
3677
4217
4163
2346
1587
3989
4469
1350
4563
6491
1304
4402
1240
2656
2225
1032
2806
633
7034
802
246
2483
5445
6988
1735...

input:

decode
1000
7
4354
7
5001
7
490
7
1798
7
2158
7
2623
7
467
7
5238
7
3565
7
3123
7
3722
7
5182
7
2702
7
2504
8
193
7
3545
7
4820
7
2685
7
7075
7
7175
7
5597
7
5309
7
3627
7
5245
7
2647
7
265
8
203
7
6951
7
5639
7
7512
7
6971
7
3583
7
5891
7
4567
7
2619
7
3108
7
304
7
3677
7
4217
7
4163
7
2346
7
1587
...

output:

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

result:

ok 1000 lines

Test #12:

score: 100
Accepted
time: 84ms
memory: 3872kb

input:

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

output:

4707
2061
4530
4898
1017
5822
3781
6707
3937
4453
5032
6520
1315
5695
109
5906
3875
4118
5920
6506
1902
545
1339
4547
5458
5703
6028
3774
6416
3170
4752
294
7020
5571
2226
771
4013
7617
7633
4733
1750
2996
5828
2764
2045
2899
3776
3260
2125
2782
3746
6368
6010
195
6637
3617
1898
7483
5860
1297
357
5...

input:

decode
1000
7
4707
7
2061
7
4530
7
4898
7
1017
7
5822
7
3781
7
6707
7
3937
7
4453
7
5032
7
6520
7
1315
7
5695
8
109
7
5906
7
3875
7
4118
7
5920
7
6506
7
1902
7
545
7
1339
7
4547
7
5458
7
5703
7
6028
7
3774
7
6416
7
3170
7
4752
7
294
7
7020
7
5571
7
2226
7
771
7
4013
7
7617
7
7633
7
4733
7
1750
7
299...

output:

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

result:

ok 1000 lines

Test #13:

score: 100
Accepted
time: 83ms
memory: 3600kb

input:

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

output:

1667
2517
7695
154
7745
7478
4300
5521
4256
4105
7703
1805
5738
2474
4624
2852
5081
5544
7575
2369
665
1314
1336
7105
487
3203
5893
800
1740
6905
2724
3515
1220
1564
5078
1809
3451
5253
715
1015
2351
4298
1889
5477
831
6768
1253
6322
4456
4054
170
252
536
6014
1978
711
4047
3634
3063
708
4063
7338
7...

input:

decode
1000
7
1667
7
2517
7
7695
8
154
7
7745
7
7478
7
4300
7
5521
7
4256
7
4105
7
7703
7
1805
7
5738
7
2474
7
4624
7
2852
7
5081
7
5544
7
7575
7
2369
7
665
7
1314
7
1336
7
7105
7
487
7
3203
7
5893
7
800
7
1740
7
6905
7
2724
7
3515
7
1220
7
1564
7
5078
7
1809
7
3451
7
5253
8
715
7
1015
7
2351
7
4298...

output:

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

result:

ok 1000 lines

Test #14:

score: 100
Accepted
time: 112ms
memory: 3656kb

input:

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

output:

11983
3964
6688
2767
27495
34661
31636
30497
16965
10615
42258
41001
24756
2152
27390
16558
1928
41059
11778
14881
33107
6435
22371
20366
23344
2392
3430
30991
21914
4640
26101
29970
23574
43226
37350
24317
27761
18843
13418
19365
7245
10635
27488
17699
3134
20628
6430
13667
24636
15177
574
17270
35...

input:

decode
1000
8
11983
8
3964
8
6688
8
2767
8
27495
8
34661
8
31636
8
30497
8
16965
8
10615
8
42258
8
41001
8
24756
8
2152
8
27390
8
16558
8
1928
8
41059
8
11778
8
14881
8
33107
8
6435
8
22371
8
20366
8
23344
8
2392
8
3430
8
30991
8
21914
8
4640
8
26101
8
29970
8
23574
8
43226
8
37350
8
24317
8
27761
8...

output:

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

result:

ok 1000 lines

Test #15:

score: 100
Accepted
time: 145ms
memory: 3664kb

input:

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

output:

182145
241560
165311
232734
33943
24803
194354
62077
147595
198972
164355
66057
229995
238431
146815
132874
67382
105741
11738
171475
156836
84580
40030
117575
14396
35960
234453
116861
34053
208801
194887
144955
163605
217152
641
168281
21788
147052
62252
23655
63032
154265
111129
86672
88529
69503...

input:

decode
1000
9
182145
9
241560
9
165311
9
232734
9
33943
9
24803
9
194354
9
62077
9
147595
9
198972
9
164355
9
66057
9
229995
9
238431
9
146815
9
132874
9
67382
9
105741
9
11738
9
171475
9
156836
9
84580
9
40030
9
117575
9
14396
9
35960
9
234453
9
116861
9
34053
9
208801
9
194887
9
144955
9
163605
9
...

output:

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

result:

ok 1000 lines

Test #16:

score: 100
Accepted
time: 184ms
memory: 3692kb

input:

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

output:

0
1430714
893207
578861
210352
196927
1007296
1408755
710962
351655
1209694
444296
381445
226018
423268
417525
417582
751551
1202296
1369007
765733
1034186
1148415
1238189
36115
683064
680556
1209587
1388679
1352031
487505
128216
725678
794061
225365
1376408
461697
882114
869746
376910
369019
135864...

input:

decode
1000
10
0
10
1430714
10
893207
10
578861
10
210352
10
196927
10
1007296
10
1408755
10
710962
10
351655
10
1209694
10
444296
10
381445
10
226018
10
423268
10
417525
10
417582
10
751551
10
1202296
10
1369007
10
765733
10
1034186
10
1148415
10
1238189
10
36115
10
683064
10
680556
10
1209587
10
1...

output:

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

result:

ok 1000 lines

Test #17:

score: 100
Accepted
time: 229ms
memory: 3664kb

input:

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

output:

0
8414639
5275832
3397975
5792667
7219927
4118999
6186120
7236914
7197104
1492612
3594093
6870414
536854
7384919
1749727
1431727
1103031
6110437
1349064
4721281
7765946
3976951
1909424
1813077
4070126
7883103
8279993
948899
3613333
7257667
3005014
4662326
5344467
8352760
762368
7170940
386131
178848...

input:

decode
1000
11
0
11
8414639
11
5275832
11
3397975
11
5792667
11
7219927
11
4118999
11
6186120
11
7236914
11
7197104
11
1492612
11
3594093
11
6870414
11
536854
11
7384919
11
1749727
11
1431727
11
1103031
11
6110437
11
1349064
11
4721281
11
7765946
11
3976951
11
1909424
11
1813077
11
4070126
11
788310...

output:

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

result:

ok 1000 lines

Test #18:

score: 100
Accepted
time: 275ms
memory: 3852kb

input:

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

output:

0
50067107
31501460
20216790
24061658
19986657
44664466
29088662
42301538
19813447
48832108
27033643
9007556
7020831
46021276
7430108
360281
34325760
19093067
9722614
44900771
16006150
31492194
11255741
25847780
17183158
21943716
45289470
48765928
19892179
12426222
45450427
7394352
42004587
1446620
...

input:

decode
1000
12
0
12
50067107
12
31501460
12
20216790
12
24061658
12
19986657
12
44664466
12
29088662
12
42301538
12
19813447
12
48832108
12
27033643
12
9007556
12
7020831
12
46021276
12
7430108
12
360281
12
34325760
12
19093067
12
9722614
12
44900771
12
16006150
12
31492194
12
11255741
12
25847780
1...

output:

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

result:

ok 1000 lines

Test #19:

score: 100
Accepted
time: 330ms
memory: 3600kb

input:

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

output:

242892263
193908085
75972709
232713377
47367652
139573256
159406283
10816265
186022336
286476148
157873976
86752293
79332025
24907187
211303872
97877013
48991719
159157627
108090631
124949307
174583936
164656817
150074712
68596181
215297838
72335059
222079057
59583219
291639660
69771718
249302635
16...

input:

decode
1000
13
242892263
13
193908085
13
75972709
13
232713377
13
47367652
13
139573256
13
159406283
13
10816265
13
186022336
13
286476148
13
157873976
13
86752293
13
79332025
13
24907187
13
211303872
13
97877013
13
48991719
13
159157627
13
108090631
13
124949307
13
174583936
13
164656817
13
1500747...

output:

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

result:

ok 1000 lines

Test #20:

score: 100
Accepted
time: 390ms
memory: 3608kb

input:

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

output:

0
1822766519
1153083940
774036305
1215186618
918199890
8665160
1750971312
931912453
1653344269
1061721196
1743587181
343586573
1805194232
1180542263
483540779
1100353960
667462004
1026618675
389568668
91619270
768461894
18982554
620434417
172762536
1006988976
516751035
1568949419
1396151552
11755465...

input:

decode
1000
14
0
14
1822766519
14
1153083940
14
774036305
14
1215186618
14
918199890
14
8665160
14
1750971312
14
931912453
14
1653344269
14
1061721196
14
1743587181
14
343586573
14
1805194232
14
1180542263
14
483540779
14
1100353960
14
667462004
14
1026618675
14
389568668
14
91619270
14
768461894
14...

output:

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

result:

ok 1000 lines

Test #21:

score: 100
Accepted
time: 453ms
memory: 3820kb

input:

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

output:

9874211569
167475982
4528653559
1908896338
5120793177
783968416
1538983858
2394376547
8169197188
10147808701
4397793777
10179838577
7714307895
7328315940
10614324252
8284976215
6752493255
8481340203
2383188213
10184152532
4406274518
1467503497
10078725304
5179842437
3590819926
10236967138
8983800023...

input:

decode
1000
15
9874211569
15
167475982
15
4528653559
15
1908896338
15
5120793177
15
783968416
15
1538983858
15
2394376547
15
8169197188
15
10147808701
15
4397793777
15
10179838577
15
7714307895
15
7328315940
15
10614324252
15
8284976215
15
6752493255
15
8481340203
15
2383188213
15
10184152532
15
440...

output:

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

result:

ok 1000 lines

Test #22:

score: 100
Accepted
time: 518ms
memory: 3868kb

input:

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

output:

0
68328754958
43397658005
29456446930
54455324196
16175779702
45978441849
53569521862
28759091732
34124992449
18810037527
38980889554
60960331087
57163360746
116131187
50292156479
61535685019
11634653192
8000431230
16576104637
22767511172
44386272154
31594951568
37495307959
30604841501
3848425609
45...

input:

decode
1000
16
0
16
68328754958
16
43397658005
16
29456446930
16
54455324196
16
16175779702
16
45978441849
16
53569521862
16
28759091732
16
34124992449
16
18810037527
16
38980889554
16
60960331087
16
57163360746
16
116131187
16
50292156479
16
61535685019
16
11634653192
16
8000431230
16
16576104637
1...

output:

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

result:

ok 1000 lines

Test #23:

score: 100
Accepted
time: 589ms
memory: 3620kb

input:

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

output:

414957232452
384033815774
134596571175
398218925430
402310975445
239056081317
395804459090
90978839698
71910036780
271572092232
218006441748
160043614803
271283613995
363358571357
234344383294
19349348148
93751412656
168193629199
228073661410
110380863176
77546533767
392311206610
134265315647
403893...

input:

decode
1000
17
414957232452
17
384033815774
17
134596571175
17
398218925430
17
402310975445
17
239056081317
17
395804459090
17
90978839698
17
71910036780
17
271572092232
17
218006441748
17
160043614803
17
271283613995
17
363358571357
17
234344383294
17
19349348148
17
93751412656
17
168193629199
17
2...

output:

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

result:

ok 1000 lines

Test #24:

score: 100
Accepted
time: 663ms
memory: 3932kb

input:

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

output:

0
2619631042664
1668912304992
1148916827260
1932954284922
2498037654563
467417583405
1295790291491
562553500938
1609791941268
425757852724
471774857558
1572673972375
603671183058
1682689760935
823356127412
2475604924581
1764303963510
931405391514
1467127106547
318697765674
2263968092965
163471823286...

input:

decode
1000
18
0
18
2619631042664
18
1668912304992
18
1148916827260
18
1932954284922
18
2498037654563
18
467417583405
18
1295790291491
18
562553500938
18
1609791941268
18
425757852724
18
471774857558
18
1572673972375
18
603671183058
18
1682689760935
18
823356127412
18
2475604924581
18
1764303963510
...

output:

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

result:

ok 1000 lines

Test #25:

score: 100
Accepted
time: 745ms
memory: 3628kb

input:

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

output:

0
16332922290299
10418692103367
6961392701156
9758823782127
4644511697705
10265799270695
13604640373519
9934784178465
4383970980859
5458532585824
14218489980717
800364926938
14389305016291
16290436383621
13389952449451
15934831414391
1137551043119
10097190740230
2506626183604
13308299209941
71543156...

input:

decode
1000
19
0
19
16332922290299
19
10418692103367
19
6961392701156
19
9758823782127
19
4644511697705
19
10265799270695
19
13604640373519
19
9934784178465
19
4383970980859
19
5458532585824
19
14218489980717
19
800364926938
19
14389305016291
19
16290436383621
19
13389952449451
19
15934831414391
19
...

output:

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

result:

ok 1000 lines

Test #26:

score: 100
Accepted
time: 843ms
memory: 3656kb

input:

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

output:

25967025372691
42766753457233
100635263624669
98996289758793
34023157302047
43939229677493
18863726757415
39653991078813
50183706707094
42792109172206
49973659232002
48797547876255
64071769647692
28187896059145
23603352676758
28979044855717
2882015634957
71968161258383
23249744517405
47126024688336
...

input:

decode
1000
20
25967025372691
20
42766753457233
20
100635263624669
20
98996289758793
20
34023157302047
20
43939229677493
20
18863726757415
20
39653991078813
20
50183706707094
20
42792109172206
20
49973659232002
20
48797547876255
20
64071769647692
20
28187896059145
20
23603352676758
20
28979044855717...

output:

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

result:

ok 1000 lines

Test #27:

score: 100
Accepted
time: 927ms
memory: 3688kb

input:

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

output:

511316088757832
450189314768916
221104845482877
171644088302858
32993397317295
602447046340851
458458869170693
437017646240737
324459767566874
36951532211929
172275436057808
37198760134988
253472830649895
234967905598927
618134419390264
389497792101970
7748526525833
16087193832805
440280628013607
12...

input:

decode
1000
21
511316088757832
21
450189314768916
21
221104845482877
21
171644088302858
21
32993397317295
21
602447046340851
21
458458869170693
21
437017646240737
21
324459767566874
21
36951532211929
21
172275436057808
21
37198760134988
21
253472830649895
21
234967905598927
21
618134419390264
21
389...

output:

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

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 1018ms
memory: 3888kb

input:

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

output:

2452533530901639
1891721311564307
3127967668669369
2872253446505024
3756770435356318
1815587651947947
1481453708877711
2549953298998657
1986183250911116
732742588303635
1953995470004171
271330054143607
3145909775804454
646349496276902
3051612432222699
1433817089211471
313047313759316
104683143096047...

input:

decode
1000
22
2452533530901639
22
1891721311564307
22
3127967668669369
22
2872253446505024
22
3756770435356318
22
1815587651947947
22
1481453708877711
22
2549953298998657
22
1986183250911116
22
732742588303635
22
1953995470004171
22
271330054143607
22
3145909775804454
22
646349496276902
22
30516124...

output:

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

result:

ok 1000 lines

Test #29:

score: 100
Accepted
time: 1112ms
memory: 3700kb

input:

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

output:

18304586030933376
4563812754096121
6078601989705133
23947666526951788
25312098521193406
11631641926486846
23582261045141172
19366471261552623
20515277759871370
8401420099174358
8176932086896411
23716306682154348
20760657188991356
16657523960258243
15091425435857287
14208555673896381
2226067622774535...

input:

decode
1000
23
18304586030933376
23
4563812754096121
23
6078601989705133
23
23947666526951788
23
25312098521193406
23
11631641926486846
23
23582261045141172
23
19366471261552623
23
20515277759871370
23
8401420099174358
23
8176932086896411
23
23716306682154348
23
20760657188991356
23
1665752396025824...

output:

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

result:

ok 1000 lines

Test #30:

score: 100
Accepted
time: 1236ms
memory: 3676kb

input:

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

output:

101163543493686080
13987371798328140
93067501312130405
110421370357390249
79417596317588275
114912174098982223
43165967167856707
31504148337184117
128141131039361604
44170904022451618
84490394923687356
121114284178699120
60622118638307728
66368923692832894
127926852737183441
44087493547719567
126301...

input:

decode
1000
24
101163543493686080
24
13987371798328140
24
93067501312130405
24
110421370357390249
24
79417596317588275
24
114912174098982223
24
43165967167856707
24
31504148337184117
24
128141131039361604
24
44170904022451618
24
84490394923687356
24
121114284178699120
24
60622118638307728
24
6636892...

output:

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

result:

ok 1000 lines

Test #31:

score: 100
Accepted
time: 1333ms
memory: 3912kb

input:

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

output:

0
1031147983159782227
661368678063000702
453416164919459671
953648266934654367
768836520868011431
108486984011818097
244169769972935773
1020849716631609005
57534922179037351
654860710039325254
178496570226172982
1004627132830707354
883307602168028083
353243733033043094
330646180579129596
37079265384...

input:

decode
1000
25
0
25
1031147983159782227
25
661368678063000702
25
453416164919459671
25
953648266934654367
25
768836520868011431
25
108486984011818097
25
244169769972935773
25
1020849716631609005
25
57534922179037351
25
654860710039325254
25
178496570226172982
25
1004627132830707354
25
88330760216802...

output:

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

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 1015ms
memory: 3856kb

input:

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

output:

157849884394352041
752052116912143749
2591099686298442
144577955239106458
120528649156150189
2141891680070579
468658192513449
62223086375153
74412605856543
16619760638272680
21919110009074562
96706663696483072
174509439143584872
857454222619060760
11179591657672137
39846125568150677
0
10023772187058...

input:

decode
1000
25
157849884394352041
25
752052116912143749
22
2591099686298442
24
144577955239106458
24
120528649156150189
23
2141891680070579
21
468658192513449
20
62223086375153
20
74412605856543
23
16619760638272680
23
21919110009074562
24
96706663696483072
25
174509439143584872
25
85745422261906076...

output:

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

result:

ok 1000 lines