QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#413567#4824. Bracket-and-bar Sequencesucup-team3097#0 2ms3904kbC++231.9kb2024-05-17 18:52:402024-05-17 18:52:41

详细

Test #1:

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

input:

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

output:

0
54
65

input:

decode
3
1
0
4
54
5
65

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

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: 3768kb

input:

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

output:

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

input:

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

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
...

input:

decode
1000
6
660
6
661
6
662
6
663
6
664
6
665
6
666
6
667
6
668
6
669
6
670
6
671
6
672
6
673
6
674
6
675
6
676
6
677
6
678
6
679
6
680
6
681
6
682
6
683
6
684
6
685
6
686
6
687
6
688
6
689
6
690
6
691
6
692
6
693
6
694
6
695
6
696
6
697
6
698
6
699
6
700
6
701
6
702
6
703
6
704
6
705
6
706
6
707
...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

6073
6400
2826
4779
1250
7361
6555
322
4030
779
1922
4409
157
5119
2780
3304
2244
5090
3167
4603
3224
2398
6452
7680
6969
4044
399
1900
7098
1127
5555
2741
5886
1740
3828
6601
7708
2328
7191
645
1994
833
4252
3049
2640
2630
6022
3377
1676
3643
6313
4111
4482
1630
401
7656
5310
4380
3527
5282
7429
61...

input:

decode
1000
7
6073
7
6400
7
2826
7
4779
7
1250
7
7361
7
6555
8
322
7
4030
7
779
7
1922
7
4409
8
157
7
5119
7
2780
7
3304
7
2244
7
5090
7
3167
7
4603
7
3224
7
2398
7
6452
7
7680
7
6969
7
4044
7
399
7
1900
7
7098
7
1127
7
5555
7
2741
7
5886
7
1740
7
3828
7
6601
7
7708
7
2328
7
7191
7
645
7
1994
7
833
...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

2477
7083
1616
701
3237
1232
5711
4698
583
5186
533
4994
369
62
3981
2061
1940
5969
314
448
5852
2820
6553
7320
5455
4309
3601
1537
1755
7692
4745
3443
232
7148
6326
5339
2919
4955
582
2152
618
4879
1721
2646
6316
3823
3553
5293
1364
1469
4530
577
1599
240
2615
5666
7175
5057
681
2712
4557
6453
288
...

input:

decode
1000
7
2477
7
7083
7
1616
7
701
7
3237
7
1232
7
5711
7
4698
7
583
7
5186
7
533
7
4994
8
369
8
62
7
3981
7
2061
7
1940
7
5969
8
314
8
448
7
5852
7
2820
7
6553
7
7320
7
5455
7
4309
7
3601
7
1537
7
1755
7
7692
7
4745
7
3443
7
232
7
7148
7
6326
7
5339
7
2919
7
4955
7
582
7
2152
7
618
7
4879
7
172...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

7140
359
3948
1846
5234
6105
3724
6585
63
2731
7653
1607
3927
7260
4684
1215
2749
5295
5679
6004
3842
3928
2155
2360
442
7734
508
4725
1414
3326
2544
4403
2017
5440
4094
350
4535
5297
5949
5977
2643
4350
6279
2812
7308
907
4133
2426
2923
4265
7037
1899
3331
3507
2219
7683
3262
5506
5599
4201
910
479...

input:

decode
1000
7
7140
7
359
7
3948
7
1846
7
5234
7
6105
7
3724
7
6585
8
63
7
2731
7
7653
7
1607
7
3927
7
7260
7
4684
7
1215
7
2749
7
5295
7
5679
7
6004
7
3842
7
3928
7
2155
7
2360
7
442
7
7734
7
508
7
4725
7
1414
7
3326
7
2544
7
4403
7
2017
7
5440
7
4094
8
350
7
4535
7
5297
7
5949
7
5977
7
2643
7
4350
...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

5522
1669
427
343
3819
5067
5737
7288
1516
7323
6734
1036
5981
1589
5302
5478
1112
5617
6845
434
2167
1097
2334
178
5684
2769
1044
5059
1158
995
454
2860
7744
1764
96
5077
1373
3411
1047
5097
5656
186
4610
4967
2673
6781
5317
6155
2390
5732
2880
3152
4688
2274
38
4555
2669
4645
189
1021
2502
1562
28...

input:

decode
1000
7
5522
7
1669
7
427
8
343
7
3819
7
5067
7
5737
7
7288
7
1516
7
7323
7
6734
7
1036
7
5981
7
1589
7
5302
7
5478
7
1112
7
5617
7
6845
8
434
7
2167
7
1097
7
2334
8
178
7
5684
7
2769
7
1044
7
5059
7
1158
7
995
8
454
7
2860
7
7744
7
1764
8
96
7
5077
7
1373
7
3411
7
1047
7
5097
7
5656
8
186
7
4...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

7403
7198
688
2632
941
5866
3623
5125
1141
1500
1773
5181
1142
3975
1602
2304
7326
1997
3137
4250
159
3946
6384
3336
89
1884
4086
5204
5289
5870
1524
7413
2335
6490
5959
3829
4273
563
5604
3439
814
686
2488
5988
6543
6934
3558
4999
289
6141
989
2651
3893
938
3693
1929
685
4498
1574
3494
2622
7332
50...

input:

decode
1000
7
7403
7
7198
7
688
7
2632
7
941
7
5866
7
3623
7
5125
7
1141
7
1500
7
1773
7
5181
7
1142
7
3975
7
1602
7
2304
7
7326
7
1997
7
3137
7
4250
8
159
7
3946
7
6384
7
3336
8
89
7
1884
7
4086
7
5204
7
5289
7
5870
7
1524
7
7413
7
2335
7
6490
7
5959
7
3829
7
4273
7
563
7
5604
7
3439
7
814
7
686
7
...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

3358
3752
963
1480
2289
5202
880
3583
6003
4146
5537
3478
5856
5510
191
5914
3115
5404
7489
7531
6435
6331
6028
3775
5822
266
233
7010
6509
7585
5327
5246
6647
3545
5166
4139
410
4747
2737
2791
2342
1988
2607
3256
957
3455
4462
1380
3185
1276
5083
2050
1106
5232
1067
7031
602
246
5395
6081
6946
2374...

input:

decode
1000
7
3358
7
3752
7
963
7
1480
7
2289
7
5202
7
880
7
3583
7
6003
7
4146
7
5537
7
3478
7
5856
7
5510
8
191
7
5914
7
3115
7
5404
7
7489
7
7531
7
6435
7
6331
7
6028
7
3775
7
5822
7
266
8
233
7
7010
7
6509
7
7585
7
5327
7
5246
7
6647
7
3545
7
5166
7
4139
7
410
7
4747
7
2737
7
2791
7
2342
7
1988
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

2992
2279
3537
3624
958
6597
5163
6843
2527
3253
3265
4554
1378
6491
158
6639
6050
2690
6119
4470
1555
748
1412
3357
6083
6534
6230
5079
4513
4293
3038
365
6191
6445
2105
519
2542
7728
5392
3011
1430
3974
5625
5853
2268
3910
5091
4299
1855
5423
5943
4366
7370
207
5325
6012
1547
5271
5300
1297
297
38...

input:

decode
1000
7
2992
7
2279
7
3537
7
3624
7
958
7
6597
7
5163
7
6843
7
2527
7
3253
7
3265
7
4554
7
1378
7
6491
8
158
7
6639
7
6050
7
2690
7
6119
7
4470
7
1555
7
748
7
1412
7
3357
7
6083
7
6534
7
6230
7
5079
7
4513
7
4293
7
3038
7
365
7
6191
7
6445
7
2105
7
519
7
2542
7
7728
7
5392
7
3011
7
1430
7
3974...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

2137
4619
7668
127
6323
7599
2784
4952
2866
2620
7724
1498
6093
5237
2951
5962
3316
6414
7699
1936
891
1362
1405
5390
1050
4182
5682
601
2104
5692
5156
5051
1119
2126
3305
1507
4818
3467
469
949
2344
2778
1527
6527
544
6978
956
7422
3259
2584
133
263
765
7195
1664
466
2582
4615
4108
464
2667
5008
49...

input:

decode
1000
7
2137
7
4619
7
7668
8
127
7
6323
7
7599
7
2784
7
4952
7
2866
7
2620
7
7724
7
1498
7
6093
7
5237
7
2951
7
5962
7
3316
7
6414
7
7699
7
1936
7
891
7
1362
7
1405
7
5390
7
1050
7
4182
7
5682
7
601
7
2104
7
5692
7
5156
7
5051
7
1119
7
2126
7
3305
7
1507
7
4818
7
3467
8
469
7
949
7
2344
7
2778...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

10245
2642
6849
5865
19982
39686
36863
36276
21868
8374
42844
27179
19100
2286
19647
21660
1568
27197
10172
31064
30265
4487
13917
30020
14983
2387
4806
34171
34003
2959
16421
30250
15435
41233
38199
15538
20285
33168
10710
26173
7622
8451
19979
23536
4278
25664
4482
27858
19397
27825
795
22647
4075...

input:

decode
1000
8
10245
8
2642
8
6849
8
5865
8
19982
8
39686
8
36863
8
36276
8
21868
8
8374
8
42844
8
27179
8
19100
8
2286
8
19647
8
21660
8
1568
8
27197
8
10172
8
31064
8
30265
8
4487
8
13917
8
30020
8
14983
8
2387
8
4806
8
34171
8
34003
8
2959
8
16421
8
30250
8
15435
8
41233
8
38199
8
15538
8
20285
8
...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

210379
244305
111679
243640
35141
17444
234624
50521
105234
236559
111624
55270
240775
159035
110770
81295
64737
130542
11427
204111
112847
171407
42024
162182
26184
24153
151683
169952
41102
140116
236978
100384
115045
149207
967
118601
33684
102192
50941
15890
68226
97240
147503
156112
178287
6054...

input:

decode
1000
9
210379
9
244305
9
111679
9
243640
9
35141
9
17444
9
234624
9
50521
9
105234
9
236559
9
111624
9
55270
9
240775
9
159035
9
110770
9
81295
9
64737
9
130542
9
11427
9
204111
9
112847
9
171407
9
42024
9
162182
9
26184
9
24153
9
151683
9
169952
9
41102
9
140116
9
236978
9
100384
9
115045
9
...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

0
1430714
537507
715347
140744
225947
1193345
1429007
921862
286086
785996
1020405
356920
239737
351793
307244
312575
453778
790775
991293
463076
907448
1316528
1267151
24580
1057620
983440
786716
1382777
1413485
895761
79240
1138028
505433
187645
1401830
817933
554635
525121
299545
366613
861072
78...

input:

decode
1000
10
0
10
1430714
10
537507
10
715347
10
140744
10
225947
10
1193345
10
1429007
10
921862
10
286086
10
785996
10
1020405
10
356920
10
239737
10
351793
10
307244
10
312575
10
453778
10
790775
10
991293
10
463076
10
907448
10
1316528
10
1267151
10
24580
10
1057620
10
983440
10
786716
10
1382...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

0
8414639
3138807
4209163
3520770
4703863
4835468
5309756
5527384
4644562
2045115
4449686
6433995
974402
5501651
2543996
2224890
1259294
5716053
1413310
2877544
8128440
5138619
1488200
2198877
5803687
8071029
8394986
584238
4431587
6143822
5767051
2952704
3269057
8388303
457940
4636414
353939
207043...

input:

decode
1000
11
0
11
8414639
11
3138807
11
4209163
11
3520770
11
4703863
11
4835468
11
5309756
11
5527384
11
4644562
11
2045115
11
4449686
11
6433995
11
974402
11
5501651
11
2543996
11
2224890
11
1259294
11
5716053
11
1413310
11
2877544
11
8128440
11
5138619
11
1488200
11
2198877
11
5803687
11
807102...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

0
50067107
18565647
25033554
34990212
24323098
44825853
21475868
27289202
24577393
47536889
15936396
10148301
4501212
31381590
4960369
278725
20940118
33201070
14336722
38393140
38962352
18571663
8631867
30824108
37846762
30327793
45027409
49281122
24973307
9773981
38659851
7559890
26729117
1839831
...

input:

decode
1000
12
0
12
50067107
12
18565647
12
25033554
12
34990212
12
24323098
12
44825853
12
21475868
12
27289202
12
24577393
12
47536889
12
15936396
12
10148301
12
4501212
12
31381590
12
4960369
12
278725
12
20940118
12
33201070
12
14336722
12
38393140
12
38962352
12
18571663
12
8631867
12
30824108
...

output:

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

result:

ok 1000 lines

Test #19:

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

input:

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

output:

276785165
134809902
86865301
263963593
49447650
204901773
93583366
12260243
110224261
177604046
194239923
61724423
65422298
31604509
252912577
172234362
49491649
93065726
205838106
152601267
120962097
99761742
174010637
52190230
257493994
57163066
258238534
81536367
221603991
54370651
288462509
1005...

input:

decode
1000
13
276785165
13
134809902
13
86865301
13
263963593
13
49447650
13
204901773
13
93583366
13
12260243
13
110224261
13
177604046
13
194239923
13
61724423
13
65422298
13
31604509
13
252912577
13
172234362
13
49491649
13
93065726
13
205838106
13
152601267
13
120962097
13
99761742
13
174010637...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

0
1822766519
669682579
911369368
717604367
1097740180
12442684
1499650377
1376297325
1183772609
731264218
1499280713
520683228
1506205245
812388253
450105023
729466151
1368941975
646969031
536985638
68653165
924676608
36535741
1174874634
102899093
603308611
351957375
1001524785
1406789619
789830951
...

input:

decode
1000
14
0
14
1822766519
14
669682579
14
911369368
14
717604367
14
1097740180
14
12442684
14
1499650377
14
1376297325
14
1183772609
14
731264218
14
1499280713
14
520683228
14
1506205245
14
812388253
14
450105023
14
729466151
14
1368941975
14
646969031
14
536985638
14
68653165
14
924676608
14
3...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

6401385404
105561394
5456349304
3056031033
8125730459
920852382
986769435
2801294435
9504978317
10156164132
5285174103
10827773364
5224939986
5094129637
6509426058
9679109464
4476919042
9054170195
3083569082
10774632544
5287513354
1671186270
7157176086
8210094601
6226017820
8279096581
9151854006
870...

input:

decode
1000
15
6401385404
15
105561394
15
5456349304
15
3056031033
15
8125730459
15
920852382
15
986769435
15
2801294435
15
9504978317
15
10156164132
15
5285174103
15
10827773364
15
5224939986
15
5094129637
15
6509426058
15
9679109464
15
4476919042
15
9054170195
15
3083569082
15
10774632544
15
52875...

output:

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

result:

ok 1000 lines

Test #22:

score: 0
Stage 1: Program answer Runtime Error

input:

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

output:

0
68328754958
24931096953
34128392930
56483053974
11843396834
30757520589
65936324625
34337977249
38049834949
17576516288
22808543260
61181409532
53198757485
142613790
58350856211
42609399084
19186841729
6437304469
12179580693
47173496582
30257325990
51566583318
21527170830
54179300067
7590132557
29...

input:


output:


result: