QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#321791#4824. Bracket-and-bar SequencesHuangHanShengAC ✓4ms3912kbC++233.7kb2024-02-05 16:12:462024-02-05 16:12:47

詳細信息

Test #1:

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

input:

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

output:

1
71
137

input:

decode
3
1
1
4
71
5
137

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

1

input:

decode
1
1
1

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

4
1
3

input:

decode
3
2
4
1
1
2
3

output:

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

result:

ok 3 lines

Test #4:

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

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:

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

1174
1251
1252
1253
1254
1256
1257
1258
1255
1259
1260
1261
1262
1263
1264
1265
1266
1268
1269
1270
1267
1271
1272
1273
1274
1275
1276
1277
1281
1282
1283
1288
1289
1290
1291
1293
1294
1295
1292
1296
1297
1298
1299
1278
1279
1280
1284
1300
1301
1302
1285
1286
1287
1303
1304
1305
1306
1307
1308
1309
...

input:

decode
1000
6
1174
6
1251
6
1252
6
1253
6
1254
6
1256
6
1257
6
1258
6
1255
6
1259
6
1260
6
1261
6
1262
6
1263
6
1264
6
1265
6
1266
6
1268
6
1269
6
1270
6
1267
6
1271
6
1272
6
1273
6
1274
6
1275
6
1276
6
1277
6
1281
6
1282
6
1283
6
1288
6
1289
6
1290
6
1291
6
1293
6
1294
6
1295
6
1292
6
1296
6
1297
6...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

7854
8197
6123
4327
3062
9178
8328
9848
3552
2152
4233
7179
9615
4376
6045
6662
5006
4461
6613
7349
6026
5145
8267
9374
9001
3663
2275
4254
8471
2907
4914
5949
5533
3760
7026
8375
9481
4998
9121
2677
4238
2766
4658
6419
5851
5764
5627
6690
3434
6844
8086
3712
7152
3327
2331
9347
7533
7127
6331
7625
...

input:

decode
1000
7
7854
7
8197
7
6123
7
4327
7
3062
7
9178
7
8328
8
9848
7
3552
7
2152
7
4233
7
7179
8
9615
7
4376
7
6045
7
6662
7
5006
7
4461
7
6613
7
7349
7
6026
7
5145
7
8267
7
9374
7
9001
7
3663
7
2275
7
4254
7
8471
7
2907
7
4914
7
5949
7
5533
7
3760
7
7026
7
8375
7
9481
7
4998
7
9121
7
2677
7
4238
7...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

5685
8441
3399
2726
6075
3029
7789
4038
2643
4747
2575
7392
10010
9584
3624
4645
4163
5575
9839
10131
5460
6140
8326
8653
4769
5215
6802
3359
3772
9462
4015
6202
2005
9078
8099
7603
6368
7386
2627
4545
2660
7463
3864
5772
8090
7024
6755
7614
3137
3242
7201
2640
3396
2021
5841
7818
9108
4350
2699
591...

input:

decode
1000
7
5685
7
8441
7
3399
7
2726
7
6075
7
3029
7
7789
7
4038
7
2643
7
4747
7
2575
7
7392
8
10010
8
9584
7
3624
7
4645
7
4163
7
5575
8
9839
8
10131
7
5460
7
6140
7
8326
7
8653
7
4769
7
5215
7
6802
7
3359
7
3772
7
9462
7
4015
7
6202
7
2005
7
9078
7
8099
7
7603
7
6368
7
7386
7
2627
7
4545
7
2660...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

9070
2178
3560
3851
5313
7878
6955
8358
9588
5932
9346
3294
3525
9152
4110
2989
5957
7638
7693
5602
7050
3526
4608
5118
2372
9492
2526
4062
3187
6094
5787
7163
4504
4900
3692
9924
7205
7520
5571
5500
5768
7103
8052
6116
8652
2285
3716
5160
6376
4662
9055
4242
6085
6308
4965
9380
6271
4767
5362
3964
...

input:

decode
1000
7
9070
7
2178
7
3560
7
3851
7
5313
7
7878
7
6955
7
8358
8
9588
7
5932
7
9346
7
3294
7
3525
7
9152
7
4110
7
2989
7
5957
7
7638
7
7693
7
5602
7
7050
7
3526
7
4608
7
5118
7
2372
7
9492
7
2526
7
4062
7
3187
7
6094
7
5787
7
7163
7
4504
7
4900
7
3692
8
9924
7
7205
7
7520
7
5571
7
5500
7
5768
7...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

4836
3450
2364
9914
7020
4470
7703
8627
3331
8732
8664
2848
5503
3386
7592
4802
2885
7674
8863
10119
4638
2470
5034
9623
7717
5971
2872
4374
2931
2326
10136
6218
9518
3775
9663
4447
3146
6176
2420
4414
7788
9725
3969
7371
5871
8799
7617
7973
5136
7688
6223
6583
4002
5062
9548
7302
5870
4090
9726
283...

input:

decode
1000
7
4836
7
3450
7
2364
8
9914
7
7020
7
4470
7
7703
7
8627
7
3331
7
8732
7
8664
7
2848
7
5503
7
3386
7
7592
7
4802
7
2885
7
7674
7
8863
8
10119
7
4638
7
2470
7
5034
8
9623
7
7717
7
5971
7
2872
7
4374
7
2931
7
2326
8
10136
7
6218
7
9518
7
3775
8
9663
7
4447
7
3146
7
6176
7
2420
7
4414
7
7788...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

8779
8529
2709
5766
2819
5506
6831
4448
2914
3287
3779
4735
2915
3615
3295
5092
8736
4274
6586
4687
9638
3554
8158
6110
9656
4217
3685
4731
7578
5511
3339
8786
5035
8288
5475
7030
4686
2630
5367
6193
2395
2704
5689
5587
8316
8885
6759
7503
9817
7956
2311
5776
3494
2818
6936
4174
2703
7269
3271
6295
...

input:

decode
1000
7
8779
7
8529
7
2709
7
5766
7
2819
7
5506
7
6831
7
4448
7
2914
7
3287
7
3779
7
4735
7
2915
7
3615
7
3295
7
5092
7
8736
7
4274
7
6586
7
4687
8
9638
7
3554
7
8158
7
6110
8
9656
7
4217
7
3685
7
4731
7
7578
7
5511
7
3339
7
8786
7
5035
7
8288
7
5475
7
7030
7
4686
7
2630
7
5367
7
6193
7
2395
7...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

6162
6878
2300
3253
5084
4725
2207
6787
5598
3744
4869
6741
5478
4770
9724
5555
6562
4789
9262
9304
8258
8101
5611
7000
5420
2040
9761
9028
8294
9407
7606
5314
8417
6346
4371
3737
2340
4125
5941
6038
5113
4166
5762
6266
2835
6292
7250
3150
5986
3079
4377
4612
2880
5298
2448
9052
2545
9778
4762
7839
...

input:

decode
1000
7
6162
7
6878
7
2300
7
3253
7
5084
7
4725
7
2207
7
6787
7
5598
7
3744
7
4869
7
6741
7
5478
7
4770
8
9724
7
5555
7
6562
7
4789
7
9262
7
9304
7
8258
7
8101
7
5611
7
7000
7
5420
7
2040
8
9761
7
9028
7
8294
7
9407
7
7606
7
5314
7
8417
7
6346
7
4371
7
3737
7
2340
7
4125
7
5941
7
6038
7
5113
7...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

6480
5070
6338
6832
2812
8370
4478
8861
5752
6262
6623
7301
3152
8289
9637
8412
5648
5899
7906
7258
3355
2128
3170
6167
7841
8308
7917
4471
7192
5214
6527
2243
8006
8248
4613
2537
5786
9486
7658
6506
3203
3614
7695
5463
5057
3511
4473
5225
3853
4801
5566
7115
8743
9732
7582
5613
3347
7636
7556
3112
...

input:

decode
1000
7
6480
7
5070
7
6338
7
6832
7
2812
7
8370
7
4478
7
8861
7
5752
7
6262
7
6623
7
7301
7
3152
7
8289
8
9637
7
8412
7
5648
7
5899
7
7906
7
7258
7
3355
7
2128
7
3170
7
6167
7
7841
7
8308
7
7917
7
4471
7
7192
7
5214
7
6527
7
2243
7
8006
7
8248
7
4613
7
2537
7
5786
7
9486
7
7658
7
6506
7
3203
7...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

4554
3973
9453
9679
8096
9399
6058
7385
6231
5845
9504
3281
7866
5287
6398
5493
6674
8229
9472
4258
2235
3135
3163
7634
2424
3933
7702
2543
4565
7756
4394
4433
2899
4515
6663
3304
4706
6743
10239
2809
5114
6056
3342
8224
2604
8921
2823
8795
6265
5828
9700
9788
2123
8528
3444
10236
5825
4080
3706
248...

input:

decode
1000
7
4554
7
3973
7
9453
8
9679
7
8096
7
9399
7
6058
7
7385
7
6231
7
5845
7
9504
7
3281
7
7866
7
5287
7
6398
7
5493
7
6674
7
8229
7
9472
7
4258
7
2235
7
3135
7
3163
7
7634
7
2424
7
3933
7
7702
7
2543
7
4565
7
7756
7
4394
7
4433
7
2899
7
4515
7
6663
7
3304
7
4706
7
6743
8
10239
7
2809
7
5114
...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

22456
13519
16629
13239
37929
47208
46312
45386
19539
18169
52424
41402
34503
12834
37536
19117
11135
41409
22388
26920
42360
14918
31881
29743
32887
12886
12454
43738
31402
14157
35907
42144
33865
51085
49160
33957
38275
30800
24306
22977
17071
18228
37925
29065
12948
21860
14904
23074
35126
23221
...

input:

decode
1000
8
22456
8
13519
8
16629
8
13239
8
37929
8
47208
8
46312
8
45386
8
19539
8
18169
8
52424
8
41402
8
34503
8
12834
8
37536
8
19117
8
11135
8
41409
8
22388
8
26920
8
42360
8
14918
8
31881
8
29743
8
32887
8
12886
8
12454
8
43738
8
31402
8
14157
8
35907
8
42144
8
33865
8
51085
8
49160
8
33957
...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

263422
297476
214300
294037
87529
76436
273808
103406
199321
277439
214165
114401
293787
237339
201009
184644
139729
133221
69144
257151
215388
143649
94824
137172
67785
82986
234215
145826
91868
228926
277233
196105
218769
231899
53330
221004
74394
191569
103654
77955
148516
208137
141769
127518
15...

input:

decode
1000
9
263422
9
297476
9
214300
9
294037
9
87529
9
76436
9
273808
9
103406
9
199321
9
277439
9
214165
9
114401
9
293787
9
237339
9
201009
9
184644
9
139729
9
133221
9
69144
9
257151
9
215388
9
143649
9
94824
9
137172
9
67785
9
82986
9
234215
9
145826
9
91868
9
228926
9
277233
9
196105
9
21876...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

299463
1730177
1192670
619560
476475
513269
1494698
1726296
764448
583382
1311051
891784
777539
539008
779453
654191
655713
1050487
1299448
1395311
1064561
1354381
1596534
1616127
329782
915933
983666
1311228
1683833
1700376
789281
429188
1037358
1117757
494336
1709480
666919
1187158
1168172
644653
...

input:

decode
1000
10
299463
10
1730177
10
1192670
10
619560
10
476475
10
513269
10
1494698
10
1726296
10
764448
10
583382
10
1311051
10
891784
10
777539
10
539008
10
779453
10
654191
10
655713
10
1050487
10
1299448
10
1395311
10
1064561
10
1354381
10
1596534
10
1616127
10
329782
10
915933
10
983666
10
131...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1730178
10144817
7006010
3596337
7183051
7777452
3952085
7941258
8049237
7730099
4399828
5695063
8398183
2231470
8055171
5542327
5061750
3025494
8100897
3129824
6375167
9860089
4168695
3230317
4837412
4795086
9839404
10121217
2646402
5211050
8292046
4754413
6585092
7085106
10127895
2492553
7726207
2...

input:

decode
1000
11
1730178
11
10144817
11
7006010
11
3596337
11
7183051
11
7777452
11
3952085
11
7941258
11
8049237
11
7730099
11
4399828
11
5695063
11
8398183
11
2231470
11
8055171
11
5542327
11
5061750
11
3025494
11
8100897
11
3129824
11
6375167
11
9860089
11
4168695
11
3230317
11
4837412
11
4795086
1...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

10144818
60211925
41646278
21182247
28777498
20768531
56983054
39912297
45370122
20349113
58282799
37206758
21577374
15989271
47387659
16251420
10425399
42722782
34349311
32774942
50088892
35032739
41630099
18785049
34232680
34735767
24175983
57170475
59719580
20721248
19933352
50126867
17966955
450...

input:

decode
1000
12
10144818
12
60211925
12
41646278
12
21182247
12
28777498
12
20768531
12
56983054
12
39912297
12
45370122
12
20349113
12
58282799
12
37206758
12
21577374
12
15989271
12
47387659
12
16251420
12
10425399
12
42722782
12
34349311
12
32774942
12
50088892
12
35032739
12
41630099
12
18785049
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

330202904
260520957
199332115
330048491
109228204
166966123
219698987
76845250
248475584
281046396
156257760
131107173
138833903
75483378
314074878
158800978
109879537
219405771
166264279
140218332
231034727
226001753
205243228
113209147
315351361
117424626
318747898
184313516
297462003
112363272
33...

input:

decode
1000
13
330202904
13
260520957
13
199332115
13
330048491
13
109228204
13
166966123
13
219698987
13
76845250
13
248475584
13
281046396
13
156257760
13
131107173
13
138833903
13
75483378
13
314074878
13
158800978
13
109879537
13
219405771
13
166264279
13
140218332
13
231034727
13
226001753
13
2...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

361042498
2183809017
1514126438
789297921
1533782827
1006804941
378566851
1868809498
1174893780
1738883832
1434643688
1868051620
1198250725
1871409378
1579869949
998657835
1405200704
1166384189
1460681642
1194387561
453550910
878585004
385526031
977028432
531349049
1370847926
779319695
1674294188
18...

input:

decode
1000
14
361042498
14
2183809017
14
1514126438
14
789297921
14
1533782827
14
1006804941
14
378566851
14
1868809498
14
1174893780
14
1738883832
14
1434643688
14
1868051620
14
1198250725
14
1871409378
14
1579869949
14
998657835
14
1405200704
14
1166384189
14
1460681642
14
1194387561
14
453550910...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

10275993041
2360874686
4545518404
6806727329
6756907173
2663358358
3466214471
6311887879
11715298236
12746607335
4376507279
13013388574
9905342373
9678582202
10356445096
11945794248
8579046337
11239852779
6850631597
12958660819
4378457239
3770986531
10578029428
7064426119
4852945113
11006548389
1125...

input:

decode
1000
15
10275993041
15
2360874686
15
4545518404
15
6806727329
15
6756907173
15
2663358358
15
3466214471
15
6311887879
15
11715298236
15
12746607335
15
4376507279
15
13013388574
15
9905342373
15
9678582202
15
10356445096
15
11945794248
15
8579046337
15
11239852779
15
6850631597
15
12958660819
...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

13308564682
81637319640
56706222687
30842594209
69574313151
25607694954
59943488447
76130637572
32179092283
30170819155
40671918563
51672976667
77402539353
68261348930
13367212544
71875055614
64392714747
44495063543
21342744457
25759031586
39563573620
59119737456
44091782912
50803480616
48865112678
...

input:

decode
1000
16
13308564682
16
81637319640
16
56706222687
16
30842594209
16
69574313151
16
25607694954
16
59943488447
16
76130637572
16
32179092283
16
30170819155
16
40671918563
16
51672976667
16
77402539353
16
68261348930
16
13367212544
16
71875055614
16
64392714747
16
44495063543
16
21342744457
16
...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

501448473289
405520744530
179780042259
494948582243
390962616479
338621677043
403814559989
241616573068
259530499562
353622334933
306045275684
256977335162
353420968804
384213472523
315293293089
97061984072
151560588247
164564051592
310171359527
195605281323
234722241633
414571500137
221583511360
48...

input:

decode
1000
17
501448473289
17
405520744530
17
179780042259
17
494948582243
17
390962616479
17
338621677043
17
403814559989
17
241616573068
17
259530499562
17
353622334933
17
306045275684
17
256977335162
17
353420968804
17
384213472523
17
315293293089
17
97061984072
17
151560588247
17
164564051592
1...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

503667864976
3123298907640
2172580169968
1253667165590
2749163259351
2423732511942
1716164900175
1499620834650
1743096361028
2040357552410
1462460893767
1308777224430
1990745755101
951069590008
2191388164151
1296001027769
3072541278037
2208339137932
1293392533458
1971858744661
882982372176
239376701...

input:

decode
1000
18
503667864976
18
3123298907640
18
2172580169968
18
1253667165590
18
2749163259351
18
2423732511942
18
1716164900175
18
1499620834650
18
1743096361028
18
2040357552410
18
1462460893767
18
1308777224430
18
1990745755101
18
951069590008
18
2191388164151
18
1296001027769
18
3072541278037
1...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

3123298907641
19456221197940
13541991011008
8141781328019
13031000181227
6785335657943
13475652395516
17859562701990
12864876270256
8823641802372
10477868636685
16149088593592
4293574372923
18394420594101
15571643796422
16514316416774
18864796064932
4402473242018
12735684460793
5616221533982
1771198...

input:

decode
1000
19
3123298907641
19
19456221197940
19
13541991011008
19
8141781328019
19
13031000181227
19
6785335657943
19
13475652395516
19
17859562701990
19
12864876270256
19
8823641802372
19
10477868636685
19
16149088593592
19
4293574372923
19
18394420594101
19
15571643796422
19
16514316416774
19
18...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

41651378482590
40919050633398
121179405100064
120574091378217
71109867848843
42425301466119
63515979659499
66059209874265
53139515162776
40960021332371
71662634812574
66306682389554
83640931631446
64214096626547
36458132907548
42162509436755
24413011767534
105700100492449
36815758663019
546167974743...

input:

decode
1000
20
41651378482590
20
40919050633398
20
121179405100064
20
120574091378217
20
71109867848843
20
42425301466119
20
63515979659499
20
66059209874265
20
53139515162776
20
40960021332371
20
71662634812574
20
66306682389554
20
83640931631446
20
64214096626547
20
36458132907548
20
4216250943675...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

624265203650929
593743233424487
442780319246420
357440731241256
166815484409475
628474358837326
668559058930890
542546335447479
321656546631874
164440765631771
314467569026887
174560563416659
241510309422450
415288133034297
657098588555678
496989244358511
127147587278248
135396220014082
567209876145...

input:

decode
1000
21
624265203650929
21
593743233424487
21
442780319246420
21
357440731241256
21
166815484409475
21
628474358837326
21
668559058930890
21
542546335447479
21
321656546631874
21
164440765631771
21
314467569026887
21
174560563416659
21
241510309422450
21
415288133034297
21
657098588555678
21
...

output:

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

result:

ok 1000 lines

Test #28:

score: 100
Accepted
time: 4ms
memory: 3672kb

input:

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

output:

3197747492641747
1975765745546525
4338539099524134
4219837427961749
3850902418356718
1905277728580331
2830479084520454
3308126171695787
1953421165409457
2249977985765425
2500154461432510
1078655520413581
4311551046715944
2134695505922033
4448833071602580
2198596027252670
1019892991599171
18169623792...

input:

decode
1000
22
3197747492641747
22
1975765745546525
22
4338539099524134
22
4219837427961749
22
3850902418356718
22
1905277728580331
22
2830479084520454
22
3308126171695787
22
1953421165409457
22
2249977985765425
22
2500154461432510
22
1078655520413581
22
4311551046715944
22
2134695505922033
22
44488...

output:

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

result:

ok 1000 lines

Test #29:

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

input:

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

output:

26488200607139021
11373830248147851
9433314779895822
29957419517741083
26328052009336033
18337447066591117
29283741387249388
28109063789965773
24510537502411021
13892404814616307
10614708560574752
24046486979756275
27175373456840952
21921364830320576
19534063376363102
19017449478575112
2855949582854...

input:

decode
1000
23
26488200607139021
23
11373830248147851
23
9433314779895822
23
29957419517741083
23
26328052009336033
23
18337447066591117
23
29283741387249388
23
28109063789965773
23
24510537502411021
23
13892404814616307
23
10614708560574752
23
24046486979756275
23
27175373456840952
23
2192136483032...

output:

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

result:

ok 1000 lines

Test #30:

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

input:

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

output:

124530118535739103
44365318724649911
129184794622438858
136651434849075159
80259673232799070
163126564720287052
109471982144306985
107593346983885113
180289061028557302
85570161349494186
96798069225334708
156851939355973568
103102887532548125
62284348336160087
164575663280617266
98033277610508258
15...

input:

decode
1000
24
124530118535739103
24
44365318724649911
24
129184794622438858
24
136651434849075159
24
80259673232799070
24
163126564720287052
24
109471982144306985
24
107593346983885113
24
180289061028557302
24
85570161349494186
24
96798069225334708
24
156851939355973568
24
103102887532548125
24
622...

output:

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

result:

ok 1000 lines

Test #31:

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

input:

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

output:

192657165369301081
1223805148529083308
854025843432301783
607670245056176372
1201032245520564599
1125596550336341434
302798836136892306
378468482370440578
971348786423394594
256129972521895196
845305109313142371
677972411731873000
1060258224855900305
926717583276404558
634149654989071699
42618925989...

input:

decode
1000
25
192657165369301081
25
1223805148529083308
25
854025843432301783
25
607670245056176372
25
1201032245520564599
25
1125596550336341434
25
302798836136892306
25
378468482370440578
25
971348786423394594
25
256129972521895196
25
845305109313142371
25
677972411731873000
25
106025822485590030...

output:

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

result:

ok 1000 lines

Test #32:

score: 100
Accepted
time: 4ms
memory: 3668kb

input:

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

output:

319243477377423130
1011049336633078545
3355232751748522
148557092613245931
160053912612994562
6840507078301936
672771098736447
82912879403395
94674837034510
21433027637656772
23045738010589223
127991516300658123
408703623467100084
1046417107017208395
12395062341447959
76221166564675900
2
18158558379...

input:

decode
1000
25
319243477377423130
25
1011049336633078545
22
3355232751748522
24
148557092613245931
24
160053912612994562
23
6840507078301936
21
672771098736447
20
82912879403395
20
94674837034510
23
21433027637656772
23
23045738010589223
24
127991516300658123
25
408703623467100084
25
104641710701720...

output:

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

result:

ok 1000 lines