QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#294504#4824. Bracket-and-bar Sequencesucup-team988#AC ✓3ms3876kbC++202.2kb2023-12-30 14:15:162023-12-30 14:15:16

详细

Test #1:

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

input:

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

output:

0
54
75

input:

decode
3
1
0
4
54
5
75

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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: 1ms
memory: 3572kb

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

829
906
907
908
909
911
912
913
910
914
915
916
917
918
919
920
921
923
924
925
922
926
927
928
929
930
932
934
936
937
938
943
944
945
946
948
949
950
947
951
952
953
954
931
933
935
939
955
956
957
940
941
942
958
959
960
961
962
963
964
966
967
968
965
969
970
971
972
274
276
278
280
284
286
288
...

input:

decode
1000
6
829
6
906
6
907
6
908
6
909
6
911
6
912
6
913
6
910
6
914
6
915
6
916
6
917
6
918
6
919
6
920
6
921
6
923
6
924
6
925
6
922
6
926
6
927
6
928
6
929
6
930
6
932
6
934
6
936
6
937
6
938
6
943
6
944
6
945
6
946
6
948
6
949
6
950
6
947
6
951
6
952
6
953
6
954
6
931
6
933
6
935
6
939
6
955
...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

6081
6424
4375
2465
1289
7417
6556
373
1585
376
2517
5406
96
2499
4267
4889
3229
2536
4840
5576
4248
3372
6494
7601
7226
1807
538
2429
6690
1134
3145
4203
3760
2072
5253
6607
7708
3224
7348
902
2667
993
2917
4638
4080
3991
3854
4908
1890
5071
6313
1905
5376
1680
558
7570
5815
5354
4558
5775
7430
618...

input:

decode
1000
7
6081
7
6424
7
4375
7
2465
7
1289
7
7417
7
6556
8
373
7
1585
7
376
7
2517
7
5406
8
96
7
2499
7
4267
7
4889
7
3229
7
2536
7
4840
7
5576
7
4248
7
3372
7
6494
7
7601
7
7226
7
1807
7
538
7
2429
7
6690
7
1134
7
3145
7
4203
7
3760
7
2072
7
5253
7
6607
7
7708
7
3224
7
7348
7
902
7
2667
7
993
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

3912
6628
1828
953
4311
1256
5984
2084
870
2804
802
5703
473
63
1729
2770
2571
3806
355
606
3697
4351
6553
6880
2954
3442
5029
1744
2149
7689
2314
4431
234
7305
6326
5797
4595
5685
854
3022
887
5588
2025
3999
6317
5251
4982
5786
1364
1510
5428
867
1818
248
4068
5939
7335
2437
926
4140
5530
6495
309
...

input:

decode
1000
7
3912
7
6628
7
1828
7
953
7
4311
7
1256
7
5984
7
2084
7
870
7
2804
7
802
7
5703
8
473
8
63
7
1729
7
2770
7
2571
7
3806
8
355
8
606
7
3697
7
4351
7
6553
7
6880
7
2954
7
3442
7
5029
7
1744
7
2149
7
7689
7
2314
7
4431
7
234
7
7305
7
6326
7
5797
7
4595
7
5685
7
854
7
3022
7
887
7
5588
7
202...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

7297
454
1605
2318
3533
6105
5182
6585
71
4169
7563
1622
1531
7363
2211
1222
4219
5788
5952
3829
5277
1533
3043
3345
599
7719
753
2259
1414
4278
4014
5392
2723
2855
1865
412
5432
5802
3798
3727
3995
5330
6279
4343
6850
482
1913
3387
4603
3061
7282
2428
4298
4537
3192
7607
4498
3096
3589
2341
512
249...

input:

decode
1000
7
7297
7
454
7
1605
7
2318
7
3533
7
6105
7
5182
7
6585
8
71
7
4169
7
7563
7
1622
7
1531
7
7363
7
2211
7
1222
7
4219
7
5788
7
5952
7
3829
7
5277
7
1533
7
3043
7
3345
7
599
7
7719
7
753
7
2259
7
1414
7
4278
7
4014
7
5392
7
2723
7
2855
7
1865
8
412
7
5432
7
5802
7
3798
7
3727
7
3995
7
5330
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

3119
1926
591
425
5247
2447
6012
6812
1688
6959
6891
1091
3730
1798
5808
2963
1112
5891
7101
594
3053
697
3261
92
5960
4247
1099
2439
1158
555
611
4445
7745
2170
138
2475
1373
4363
647
2562
5929
198
1992
5640
4098
7026
5822
6200
3363
6005
4450
4809
2223
3289
23
5529
4097
2078
201
1076
3930
1780
281
...

input:

decode
1000
7
3119
7
1926
7
591
8
425
7
5247
7
2447
7
6012
7
6812
7
1688
7
6959
7
6891
7
1091
7
3730
7
1798
7
5808
7
2963
7
1112
7
5891
7
7101
8
594
7
3053
7
697
7
3261
8
92
7
5960
7
4247
7
1099
7
2439
7
1158
7
555
8
611
7
4445
7
7745
7
2170
8
138
7
2475
7
1373
7
4363
7
647
7
2562
7
5929
8
198
7
199...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

7006
6718
936
3993
1047
3733
5058
2505
1141
1604
2198
2800
1142
1711
1596
3319
6963
2670
4813
2784
113
1601
6391
4307
131
2396
1851
3084
5783
3738
1704
7013
3262
6515
3702
5257
3069
857
3594
4428
622
932
3916
3814
6543
7106
4986
5708
311
6183
550
4003
1469
1044
5163
2542
930
5496
1552
4522
3960
6968...

input:

decode
1000
7
7006
7
6718
7
936
7
3993
7
1047
7
3733
7
5058
7
2505
7
1141
7
1604
7
2198
7
2800
7
1142
7
1711
7
1596
7
3319
7
6963
7
2670
7
4813
7
2784
8
113
7
1601
7
6391
7
4307
8
131
7
2396
7
1851
7
3084
7
5783
7
3738
7
1704
7
7013
7
3262
7
6515
7
3702
7
5257
7
3069
7
857
7
3594
7
4428
7
622
7
932
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

4388
5101
487
1532
3311
3082
408
5014
3825
1969
3130
4961
3705
3097
203
3782
4789
2818
7489
7531
6485
6328
3838
5227
3647
267
236
7256
6521
7634
5833
3545
6691
4573
2708
1955
567
2316
4187
4301
3340
2661
3989
4493
1060
4519
5477
1377
4168
1306
2529
2759
1107
3528
675
7279
766
253
2809
6064
7216
3272...

input:

decode
1000
7
4388
7
5101
7
487
7
1532
7
3311
7
3082
7
408
7
5014
7
3825
7
1969
7
3130
7
4961
7
3705
7
3097
8
203
7
3782
7
4789
7
2818
7
7489
7
7531
7
6485
7
6328
7
3838
7
5227
7
3647
7
267
8
236
7
7256
7
6521
7
7634
7
5833
7
3545
7
6691
7
4573
7
2708
7
1955
7
567
7
2316
7
4187
7
4301
7
3340
7
2661
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

4707
3297
4565
5059
1061
6597
2687
7097
3979
4489
4850
5528
1379
6516
112
6681
3875
4126
6131
5485
1736
328
1397
4360
6068
6535
6148
2477
5419
3441
4754
468
6233
6475
2902
773
4013
7712
5885
4733
1432
1709
5898
3698
3284
1503
2537
3452
2332
2820
3793
5342
6970
207
5831
3840
1718
5764
5805
1339
337
5...

input:

decode
1000
7
4707
7
3297
7
4565
7
5059
7
1061
7
6597
7
2687
7
7097
7
3979
7
4489
7
4850
7
5528
7
1379
7
6516
8
112
7
6681
7
3875
7
4126
7
6131
7
5485
7
1736
7
328
7
1397
7
4360
7
6068
7
6535
7
6148
7
2477
7
5419
7
3441
7
4754
7
468
7
6233
7
6475
7
2902
7
773
7
4013
7
7712
7
5885
7
4733
7
1432
7
170...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

3025
2020
7680
154
6323
7626
4275
5682
4458
4072
7731
1600
6093
3536
4625
3720
4901
6456
7699
2549
438
1362
1390
5883
651
2124
5957
762
2886
5973
2680
2414
1126
3012
4890
1634
2933
4950
716
1052
3341
4261
1710
6451
831
7148
1059
7022
4492
4055
175
263
318
6711
1914
711
4052
2001
1897
709
4095
5717
5...

input:

decode
1000
7
3025
7
2020
7
7680
8
154
7
6323
7
7626
7
4275
7
5682
7
4458
7
4072
7
7731
7
1600
7
6093
7
3536
7
4625
7
3720
7
4901
7
6456
7
7699
7
2549
7
438
7
1362
7
1390
7
5883
7
651
7
2124
7
5957
7
762
7
2886
7
5973
7
2680
7
2414
7
1126
7
3012
7
4890
7
1634
7
2933
7
4950
8
716
7
1052
7
3341
7
4261...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

13336
3994
7110
3714
28404
37719
36787
35829
9421
9536
42899
31745
25053
3309
28009
8593
1792
31766
13005
17116
32788
5393
22358
20180
23362
3361
2787
34213
21877
4633
26382
32770
24307
41506
39635
24554
28800
21278
14220
14125
7535
9654
28400
19540
3423
11237
5376
13737
25601
13200
479
10231
39055
...

input:

decode
1000
8
13336
8
3994
8
7110
8
3714
8
28404
8
37719
8
36787
8
35829
8
9421
8
9536
8
42899
8
31745
8
25053
8
3309
8
28009
8
8593
8
1792
8
31766
8
13005
8
17116
8
32788
8
5393
8
22358
8
20180
8
23362
8
3361
8
2787
8
34213
8
21877
8
4633
8
26382
8
32770
8
24307
8
41506
8
39635
8
24554
8
28800
8
21...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

210636
244798
161512
241057
34742
23378
220599
57985
146467
224651
161367
68694
241227
182073
148221
131856
93002
78875
16042
204363
162600
90417
42036
77946
14242
30205
180643
85503
39080
176138
224442
144151
165971
178020
492
168216
21601
137359
58469
25163
102030
155349
93173
75774
96480
82431
14...

input:

decode
1000
9
210636
9
244798
9
161512
9
241057
9
34742
9
23378
9
220599
9
57985
9
146467
9
224651
9
161367
9
68694
9
241227
9
182073
9
148221
9
131856
9
93002
9
78875
9
16042
9
204363
9
162600
9
90417
9
42036
9
77946
9
14242
9
30205
9
180643
9
85503
9
39080
9
176138
9
224442
9
144151
9
165971
9
178...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

0
1430714
893207
306946
177012
213601
1194937
1426833
431719
320683
1011722
610673
500078
239545
492105
375490
386095
751460
1000762
1093204
764968
1056472
1297059
1316659
30319
597433
683044
1011783
1384360
1400198
481382
129724
737985
824294
195397
1410017
355934
887695
868817
362714
529574
104449...

input:

decode
1000
10
0
10
1430714
10
893207
10
306946
10
177012
10
213601
10
1194937
10
1426833
10
431719
10
320683
10
1011722
10
610673
10
500078
10
239545
10
492105
10
375490
10
386095
10
751460
10
1000762
10
1093204
10
764968
10
1056472
10
1297059
10
1316659
10
30319
10
597433
10
683044
10
1011783
10
1...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

0
8414639
5275832
1811940
5451707
6047274
2192759
6259598
6311343
5999597
2843507
3964896
6670837
504868
6324272
3812187
3331464
1295316
6377782
1399612
4660178
8129911
2286963
1575145
3248550
3017259
8111756
8391039
916224
3621578
6572651
2907974
4873862
5354928
8397712
762424
5995910
480437
208478...

input:

decode
1000
11
0
11
8414639
11
5275832
11
1811940
11
5451707
11
6047274
11
2192759
11
6259598
11
6311343
11
5999597
11
2843507
11
3964896
11
6670837
11
504868
11
6324272
11
3812187
11
3331464
11
1295316
11
6377782
11
1399612
11
4660178
11
8129911
11
2286963
11
1575145
11
3248550
11
3017259
11
811175...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

0
50067107
31501460
10799389
18422776
9971505
46834280
29627187
35227443
9115895
48097837
27060118
12371570
5844453
37320585
6069988
313631
32561524
24225981
22652254
39882540
24884781
31485177
8865820
24019991
24590949
14001308
47025657
49574494
9876791
11160302
40141851
7822924
34961947
2351376
21...

input:

decode
1000
12
0
12
50067107
12
31501460
12
10799389
12
18422776
12
9971505
12
46834280
12
29627187
12
35227443
12
9115895
12
48097837
12
27060118
12
12371570
12
5844453
12
37320585
12
6069988
12
313631
12
32561524
12
24225981
12
22652254
12
39882540
12
24884781
12
31485177
12
8865820
12
24019991
12...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

270329818
200300514
139120708
270677716
48970804
102420047
159487846
17395224
188265045
220291866
94067623
74765762
83827389
14527179
253883787
100717125
49670121
159193845
103142403
80978565
171204661
165787414
144942348
56174238
255139424
64358312
258541267
126986626
235768894
54340620
272887830
1...

input:

decode
1000
13
270329818
13
200300514
13
139120708
13
270677716
13
48970804
13
102420047
13
159487846
13
17395224
13
188265045
13
220291866
13
94067623
13
74765762
13
83827389
13
14527179
13
253883787
13
100717125
13
49670121
13
159193845
13
103142403
13
80978565
13
171204661
13
165787414
13
1449423...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

0
1822766519
1153083940
416203336
1172744871
651855577
17933672
1507767179
794593343
1373881833
1073805074
1507004489
837758884
1510085040
1218853307
655792810
1041828899
767981260
1099614192
832614555
92413879
531385631
24526669
627650271
171043771
1009823071
404430308
1313263860
1457296231
1202848...

input:

decode
1000
14
0
14
1822766519
14
1153083940
14
416203336
14
1172744871
14
651855577
14
17933672
14
1507767179
14
794593343
14
1373881833
14
1073805074
14
1507004489
14
837758884
14
1510085040
14
1218853307
14
655792810
14
1041828899
14
767981260
14
1099614192
14
832614555
14
92413879
14
531385631
1...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

8082098439
178097426
2301778501
4901098158
4418465605
492205331
1282199889
4213888916
9530899867
10562798361
1967388971
10829580463
7721534751
7493408416
8171328124
9765714172
6362675013
9060919358
4916018540
10774851805
1974665655
1585522691
8373555535
4844357488
2735622237
8781294932
9067626347
56...

input:

decode
1000
15
8082098439
15
178097426
15
2301778501
15
4901098158
15
4418465605
15
492205331
15
1282199889
15
4213888916
15
9530899867
15
10562798361
15
1967388971
15
10829580463
15
7721534751
15
7493408416
15
8171328124
15
9765714172
15
6362675013
15
9060919358
15
4916018540
15
10774851805
15
1974...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

0
68328754958
43397658005
17087763641
56264796896
13473673828
46634918177
62821881326
19001957224
16781235529
26875722682
38561268807
64093974689
54937582815
50399337
58561162404
50905575890
31186282952
8055790559
13772309598
25676839112
45811172774
29288584120
37494919159
35561028606
3874936262
453...

input:

decode
1000
16
0
16
68328754958
16
43397658005
16
17087763641
16
56264796896
16
13473673828
16
46634918177
16
62821881326
16
19001957224
16
16781235529
16
26875722682
16
38561268807
16
64093974689
16
54937582815
16
50399337
16
58561162404
16
50905575890
16
31186282952
16
8055790559
16
13772309598
16...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

419824929785
323375443741
92492117174
413292265786
307967330927
257010586293
321512819666
164413840069
182805381456
271985015054
224407956043
173808597377
271777737181
302576187892
233656818031
15157076702
71525864363
75306922870
228615777739
112819859258
158247868963
331936702730
139617202180
40158...

input:

decode
1000
17
419824929785
17
323375443741
17
92492117174
17
413292265786
17
307967330927
17
257010586293
17
321512819666
17
164413840069
17
182805381456
17
271985015054
17
224407956043
17
173808597377
17
271777737181
17
302576187892
17
233656818031
17
15157076702
17
71525864363
17
75306922870
17
2...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

0
2619631042664
1668912304992
744835969451
2245522394441
1911862868919
1212496575181
975463476687
1239427352804
1532876957757
991857075629
824809794362
1483145945415
472198549673
1687602938009
786190349130
2569506815717
1704671272956
786337547682
1468190803100
380105378361
1890100075175
163522231574...

input:

decode
1000
18
0
18
2619631042664
18
1668912304992
18
744835969451
18
2245522394441
18
1911862868919
18
1212496575181
18
975463476687
18
1239427352804
18
1532876957757
18
991857075629
18
824809794362
18
1483145945415
18
472198549673
18
1687602938009
18
786190349130
18
2569506815717
18
1704671272956
...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

0
16332922290299
10418692103367
4963550636750
9874095784300
3894828232493
10352353487917
14713028264304
9712545635973
5688534527094
7274918188850
12958861706523
1160436026760
15267981361517
12423689556182
13382277000179
15736659473548
1279164093571
9592789100007
2493005637797
14599028558817
60234072...

input:

decode
1000
19
0
19
16332922290299
19
10418692103367
19
4963550636750
19
9874095784300
19
3894828232493
19
10352353487917
19
14713028264304
19
9712545635973
19
5688534527094
19
7274918188850
19
12958861706523
19
1160436026760
19
15267981361517
19
12423689556182
19
13382277000179
19
15736659473548
19...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

22978752340202
21354489883919
101729615007520
101117880300333
51704897402441
22489351071015
46213947416072
47062369432576
32859785996834
21435416003979
52206839596106
45924766821420
64194384863741
45227429799952
17692041982456
23602484024695
5055277570599
86243659581919
18348001411032
35695557249298...

input:

decode
1000
20
22978752340202
20
21354489883919
20
101729615007520
20
101117880300333
20
51704897402441
20
22489351071015
20
46213947416072
20
47062369432576
20
32859785996834
20
21435416003979
20
52206839596106
20
45924766821420
20
64194384863741
20
45227429799952
20
17692041982456
20
2360248402469...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

503334628547456
475190613568284
321195105898996
240154457581650
46576603747915
505299356498527
546775712648821
420643035593199
199091292637107
41590297145637
193796964530135
52855979487524
104722002173504
296501860049809
535402257432521
375859298042331
5375143831021
13699590462231
445544139682676
28...

input:

decode
1000
21
503334628547456
21
475190613568284
21
321195105898996
21
240154457581650
21
46576603747915
21
505299356498527
21
546775712648821
21
420643035593199
21
199091292637107
21
41590297145637
21
193796964530135
21
52855979487524
21
104722002173504
21
296501860049809
21
535402257432521
21
375...

output:

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

result:

ok 1000 lines

Test #28:

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

input:

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

output:

2436884625079379
1207049889966795
3576701246466657
3455829549237137
3088738290273551
1103079317457965
2066422491690005
2546603049472524
1159706681136290
1506107089595675
1702578492059871
314646737778535
3549288191971041
1382749143198439
3697731999590569
1412858097788318
256756408804697
1061928449628...

input:

decode
1000
22
2436884625079379
22
1207049889966795
22
3576701246466657
22
3455829549237137
22
3088738290273551
22
1103079317457965
22
2066422491690005
22
2546603049472524
22
1159706681136290
22
1506107089595675
22
1702578492059871
22
314646737778535
22
3549288191971041
22
1382749143198439
22
369773...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

21670559195699368
6759136742813951
5193426379334256
25145317862297753
21515518236098560
13524358613573224
24472850642221890
23384553065561945
19700151732901274
8968875847363879
5754319529873415
19154380119178621
22332957682640722
17109129335837240
14707283993179460
14204670501097221
2374651379150860...

input:

decode
1000
23
21670559195699368
23
6759136742813951
23
5193426379334256
23
25145317862297753
23
21515518236098560
23
13524358613573224
23
24472850642221890
23
23384553065561945
23
19700151732901274
23
8968875847363879
23
5754319529873415
23
19154380119178621
23
22332957682640722
23
1710912933583724...

output:

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

result:

ok 1000 lines

Test #30:

score: 100
Accepted
time: 3ms
memory: 3644kb

input:

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

output:

93673491794096684
13954868744339020
98686787312225412
106243383435424120
49388356494361234
132729715179061611
79095255513551037
77202311906542940
149882088798934240
55222749428186121
64879907124773242
126528049115760489
72917207552011448
30063387727318173
134169200768671280
67016530151648219
1247762...

input:

decode
1000
24
93673491794096684
24
13954868744339020
24
98686787312225412
24
106243383435424120
24
49388356494361234
24
132729715179061611
24
79095255513551037
24
77202311906542940
24
149882088798934240
24
55222749428186121
24
64879907124773242
24
126528049115760489
24
72917207552011448
24
30063387...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

0
1031147983159782227
661368678063000702
423852752036139620
1008375080724984607
935061227912001960
110128449381792148
209373574423334590
775758596791869278
62111278220247576
652580329958754733
485315245779254388
867601598682305443
734060304217813584
437526511967617757
240718783230950488
276917872862...

input:

decode
1000
25
0
25
1031147983159782227
25
661368678063000702
25
423852752036139620
25
1008375080724984607
25
935061227912001960
25
110128449381792148
25
209373574423334590
25
775758596791869278
25
62111278220247576
25
652580329958754733
25
485315245779254388
25
867601598682305443
25
734060304217813...

output:

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

result:

ok 1000 lines

Test #32:

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

input:

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

output:

126489705338193014
820495362218715687
2591222832596031
118054940736171073
129878584905270099
2028060766895882
551074991112623
63457944252639
75777406248688
16620504012744852
18233717486434068
97566586778208776
231696400824580634
853449987365291072
7518680453491559
46246047421140663
0
108520866551324...

input:

decode
1000
25
126489705338193014
25
820495362218715687
22
2591222832596031
24
118054940736171073
24
129878584905270099
23
2028060766895882
21
551074991112623
20
63457944252639
20
75777406248688
23
16620504012744852
23
18233717486434068
24
97566586778208776
25
231696400824580634
25
85344998736529107...

output:

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

result:

ok 1000 lines