QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#321841#4824. Bracket-and-bar SequencesMaMengQi0 4ms3836kbC++232.2kb2024-02-05 17:44:042024-02-05 17:44:04

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

output:

0
0
93

input:

decode
3
1
0
4
0
5
93

output:

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

result:

ok 3 lines

Test #2:

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

input:

encode
1
1
(|)

output:

0

input:

decode
1
1
0

output:

(|)

result:

ok single line: '(|)'

Test #3:

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

input:

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

output:

0
0
1

input:

decode
3
2
0
1
0
2
1

output:

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

result:

ok 3 lines

Test #4:

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

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:

15
7
3
29
13
5
1
30
14
6
2
0
63
31
15
119
55
23
7
123
59
27
11
3
125
61
29
237
245
249
109
45
13
117
53
21
5
121
57
25
9
1
126
62
30
238
110
46
14
246
250
252
118
122
124
54
22
6
58
26
10
2
60
28
12
4
0
255
127
63
479
223
95
31
495
239
111
47
15
503
247
119
951
983
999
439
183
55
471
215
87
23
487
2...

input:

decode
1000
3
15
3
7
3
3
3
29
3
13
3
5
3
1
3
30
3
14
3
6
3
2
3
0
4
63
4
31
4
15
4
119
4
55
4
23
4
7
4
123
4
59
4
27
4
11
4
3
4
125
4
61
4
29
4
237
4
245
4
249
4
109
4
45
4
13
4
117
4
53
4
21
4
5
4
121
4
57
4
25
4
9
4
1
4
126
4
62
4
30
4
238
4
110
4
46
4
14
4
246
4
250
4
252
4
118
4
122
4
124
4
54
4
...

output:

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

result:

ok 1000 lines

Test #5:

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

input:

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

output:

8161
3801
3929
3993
3817
3945
4009
4041
3825
3953
4017
4049
4065
1753
729
217
1881
857
345
89
1945
921
409
153
25
1769
745
233
1897
1961
1993
873
361
105
937
425
169
41
969
457
201
73
9
1777
753
241
1905
881
369
113
1969
2001
2017
945
977
993
433
177
49
465
209
81
17
481
225
97
33
1
2046
1022
510
38...

input:

decode
1000
6
8161
6
3801
6
3929
6
3993
6
3817
6
3945
6
4009
6
4041
6
3825
6
3953
6
4017
6
4049
6
4065
6
1753
6
729
6
217
6
1881
6
857
6
345
6
89
6
1945
6
921
6
409
6
153
6
25
6
1769
6
745
6
233
6
1897
6
1961
6
1993
6
873
6
361
6
105
6
937
6
425
6
169
6
41
6
969
6
457
6
201
6
73
6
9
6
1777
6
753
6
2...

output:

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

result:

ok 1000 lines

Test #6:

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

input:

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

output:

64342
30422
24373
61306
7787
1972
2982
1503
990
3707
28601
63918
15295
63462
23509
15161
121829
28652
1861
14
2681
130393
7574
7920
3042
31198
8135
8169
7484
32459
16344
3445
130666
15853
3889
13754
24
129657
1820
6087
6073
31931
31598
30181
3917
61133
130788
11753
14237
7577
65368
15966
29646
64413...

input:

decode
1000
7
64342
7
30422
7
24373
7
61306
7
7787
7
1972
7
2982
8
1503
7
990
7
3707
7
28601
7
63918
8
15295
7
63462
7
23509
7
15161
7
121829
7
28652
7
1861
7
14
7
2681
7
130393
7
7574
7
7920
7
3042
7
31198
7
8135
7
8169
7
7484
7
32459
7
16344
7
3445
7
130666
7
15853
7
3889
7
13754
7
24
7
129657
7
1...

output:

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

result:

ok 1000 lines

Test #7:

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

input:

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

output:

365
12092
11997
295
3001
15723
24428
16122
7575
64492
31959
31862
130399
63359
31934
65393
4045
130284
62943
260767
129514
57061
102
4080
32230
122318
32673
15037
28141
3824
6902
8145
943
7388
3510
62450
31413
374
16151
15993
1767
60284
2041
64333
65384
433
32089
60380
7635
15741
64846
7063
2525
171...

input:

decode
1000
7
365
7
12092
7
11997
7
295
7
3001
7
15723
7
24428
7
16122
7
7575
7
64492
7
31959
7
31862
8
130399
8
63359
7
31934
7
65393
7
4045
7
130284
8
62943
8
260767
7
129514
7
57061
7
102
7
4080
7
32230
7
122318
7
32673
7
15037
7
28141
7
3824
7
6902
7
8145
7
943
7
7388
7
3510
7
62450
7
31413
7
37...

output:

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

result:

ok 1000 lines

Test #8:

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

input:

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

output:

14044
3031
16190
2805
125932
65414
7625
1734
30591
4981
7144
7901
3710
15096
14844
2795
2421
60404
24518
130508
1873
1662
16057
126425
63431
1968
567
30458
1955
7145
14765
24366
64461
65460
14046
126815
65166
27574
130716
126932
64205
11630
65356
56757
12272
32219
16158
128881
1717
15726
1890
8153
2...

input:

decode
1000
7
14044
7
3031
7
16190
7
2805
7
125932
7
65414
7
7625
7
1734
8
30591
7
4981
7
7144
7
7901
7
3710
7
15096
7
14844
7
2795
7
2421
7
60404
7
24518
7
130508
7
1873
7
1662
7
16057
7
126425
7
63431
7
1968
7
567
7
30458
7
1955
7
7145
7
14765
7
24366
7
64461
7
65460
7
14046
8
126815
7
65166
7
275...

output:

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

result:

ok 1000 lines

Test #9:

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

input:

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

output:

16218
1373
64919
24287
8097
8180
7994
28532
28093
30668
32410
3819
126936
28125
27626
32188
30443
57046
234
252831
16233
65379
122553
32575
24042
2677
4067
8166
15067
8147
261663
60885
208
30189
29567
61404
3507
57241
64731
12250
57196
57023
4086
61046
15565
1754
11228
63402
126897
8038
63973
3013
2...

input:

decode
1000
7
16218
7
1373
7
64919
8
24287
7
8097
7
8180
7
7994
7
28532
7
28093
7
30668
7
32410
7
3819
7
126936
7
28125
7
27626
7
32188
7
30443
7
57046
7
234
8
252831
7
16233
7
65379
7
122553
8
32575
7
24042
7
2677
7
4067
7
8166
7
15067
7
8147
8
261663
7
60885
7
208
7
30189
8
29567
7
61404
7
3507
7
...

output:

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

result:

ok 1000 lines

Test #10:

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

input:

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

output:

32184
11756
7591
61325
5611
128730
857
63452
31699
16189
1517
64474
31715
446
32605
128933
30676
6129
7845
65358
125887
15806
5590
11249
23423
16357
31582
15290
60378
129882
14781
32600
122681
2790
129528
1841
16078
855
122740
8137
64827
2983
30317
128948
2918
14194
32409
13948
125919
64730
8043
649...

input:

decode
1000
7
32184
7
11756
7
7591
7
61325
7
5611
7
128730
7
857
7
63452
7
31699
7
16189
7
1517
7
64474
7
31715
7
446
7
32605
7
128933
7
30676
7
6129
7
7845
7
65358
8
125887
7
15806
7
5590
7
11249
8
23423
7
16357
7
31582
7
15290
7
60378
7
129882
7
14781
7
32600
7
122681
7
2790
7
129528
7
1841
7
1607...

output:

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

result:

ok 1000 lines

Test #11:

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

input:

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

output:

24025
753
32667
1661
129941
15318
30683
32113
129996
798
16092
12209
126874
15846
7615
130898
16165
65478
620
396
1366
31158
130680
113
130406
335
30399
1490
14182
1748
3058
127980
7738
65377
2006
414
64823
6908
62837
11189
130233
6093
62925
63161
2547
61393
6958
3891
13177
7627
28646
64985
32347
12...

input:

decode
1000
7
24025
7
753
7
32667
7
1661
7
129941
7
15318
7
30683
7
32113
7
129996
7
798
7
16092
7
12209
7
126874
7
15846
8
7615
7
130898
7
16165
7
65478
7
620
7
396
7
1366
7
31158
7
130680
7
113
7
130406
7
335
8
30399
7
1490
7
14182
7
1748
7
3058
7
127980
7
7738
7
65377
7
2006
7
414
7
64823
7
6908
...

output:

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

result:

ok 1000 lines

Test #12:

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

input:

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

output:

5845
126805
65201
7513
475
28090
6132
3306
61101
62905
11705
2766
691
742
121791
15930
131040
333
60906
3630
32317
1787
4035
56817
63974
15782
63980
61428
61134
122670
1685
32439
65378
15254
32217
6615
1453
752
1016
853
2045
2494
56762
129522
129717
14206
28660
129710
7413
64956
129884
11886
32108
6...

input:

decode
1000
7
5845
7
126805
7
65201
7
7513
7
475
7
28090
7
6132
7
3306
7
61101
7
62905
7
11705
7
2766
7
691
7
742
8
121791
7
15930
7
131040
7
333
7
60906
7
3630
7
32317
7
1787
7
4035
7
56817
7
63974
7
15782
7
63980
7
61428
7
61134
7
122670
7
1685
7
32439
7
65378
7
15254
7
32217
7
6615
7
1453
7
752
7...

output:

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

result:

ok 1000 lines

Test #13:

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

input:

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

output:

15333
6134
1512
64639
65504
484
7141
2422
63189
461
200
15805
63430
127926
1333
126712
1593
1750
216
12265
2035
7859
483
1004
64859
61166
24378
30183
31729
24522
6074
16370
32107
16173
15673
61117
32122
28625
15071
14811
128825
56293
445
32454
5847
16210
2539
32720
61241
1325
1663
831
31611
28140
70...

input:

decode
1000
7
15333
7
6134
7
1512
8
64639
7
65504
7
484
7
7141
7
2422
7
63189
7
461
7
200
7
15805
7
63430
7
127926
7
1333
7
126712
7
1593
7
1750
7
216
7
12265
7
2035
7
7859
7
483
7
1004
7
64859
7
61166
7
24378
7
30183
7
31729
7
24522
7
6074
7
16370
7
32107
7
16173
7
15673
7
61117
7
32122
7
28625
8
1...

output:

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

result:

ok 1000 lines

Test #14:

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

input:

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

output:

28645
252727
23979
507787
27481
58844
63302
252390
124606
5949
28376
243324
64241
521559
243609
114494
6391
258684
61397
261542
482794
96059
499501
1007476
2829
507687
257515
505558
1047024
46935
244949
482998
450005
49120
6810
237477
15305
1030890
262001
10106
28131
14653
23385
1029742
511419
12671...

input:

decode
1000
8
28645
8
252727
8
23979
8
507787
8
27481
8
58844
8
63302
8
252390
8
124606
8
5949
8
28376
8
243324
8
64241
8
521559
8
243609
8
114494
8
6391
8
258684
8
61397
8
261542
8
482794
8
96059
8
499501
8
1007476
8
2829
8
507687
8
257515
8
505558
8
1047024
8
46935
8
244949
8
482998
8
450005
8
491...

output:

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

result:

ok 1000 lines

Test #15:

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

input:

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

output:

47910
3928
2095305
504816
1963475
224743
778072
482717
4091761
2063156
2023241
6389
123860
4037620
4191537
101837
129957
2080206
2093911
58550
1041753
261542
48435
393080
1047003
784571
1997948
2095988
978659
116430
2055656
505657
457321
379770
523455
507665
4153059
154609
259357
2070423
1015349
490...

input:

decode
1000
9
47910
9
3928
9
2095305
9
504816
9
1963475
9
224743
9
778072
9
482717
9
4091761
9
2063156
9
2023241
9
6389
9
123860
9
4037620
9
4191537
9
101837
9
129957
9
2080206
9
2093911
9
58550
9
1041753
9
261542
9
48435
9
393080
9
1047003
9
784571
9
1997948
9
2095988
9
978659
9
116430
9
2055656
9
...

output:

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

result:

ok 1000 lines

Test #16:

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

input:

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

output:

262143
0
87381
782814
22843
1996019
8023958
1047872
1834908
178077
2014766
7828918
16381781
2074419
2881337
2084089
29945
32349869
3732942
15399772
6281773
138198
15595740
4108058
8297711
16741748
64683916
2090542
8240788
187888
3929062
16596151
67082712
3731365
2091443
2025268
32764406
16243909
423...

input:

decode
1000
10
262143
10
0
10
87381
10
782814
10
22843
10
1996019
10
8023958
10
1047872
10
1834908
10
178077
10
2014766
10
7828918
10
16381781
10
2074419
10
2881337
10
2084089
10
29945
10
32349869
10
3732942
10
15399772
10
6281773
10
138198
10
15595740
10
4108058
10
8297711
10
16741748
10
64683916
1...

output:

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

result:

ok 1000 lines

Test #17:

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

input:

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

output:

1048575
0
349525
27113310
85985
16665486
25107196
23016422
99524314
125039438
31841741
535950510
98418532
14139283
2318066
502982377
268311405
64974027
29162902
3854243
121592949
67070252
62908396
125237693
125493097
15727736
24993624
8365424
15584487
66812110
12543898
4157362
56097333
4053285
76957...

input:

decode
1000
11
1048575
11
0
11
349525
11
27113310
11
85985
11
16665486
11
25107196
11
23016422
11
99524314
11
125039438
11
31841741
11
535950510
11
98418532
11
14139283
11
2318066
11
502982377
11
268311405
11
64974027
11
29162902
11
3854243
11
121592949
11
67070252
11
62908396
11
125237693
11
125493...

output:

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

result:

ok 1000 lines

Test #18:

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

input:

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

output:

4194303
0
1398101
107920094
1048506260
100346302
230481354
1862069145
803147598
519912926
91219876
937349805
198097389
7092667
128943084
1064611307
233796063
30506705
4280086264
4143247205
804638538
4250922182
6069845
12348797
3992515576
4026460486
930789338
267830130
64421252
2113333662
29277341
26...

input:

decode
1000
12
4194303
12
0
12
1398101
12
107920094
12
1048506260
12
100346302
12
230481354
12
1862069145
12
803147598
12
519912926
12
91219876
12
937349805
12
198097389
12
7092667
12
128943084
12
1064611307
12
233796063
12
30506705
12
4280086264
12
4143247205
12
804638538
12
4250922182
12
6069845
1...

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:

399367772
2011662233
33686908373
668792290
260796355
872402354
8480336493
381417127
8497093333
8018881148
74710512
7512945913
49436629
62847859
936328022
1835982198
124598115
8318773613
1602170738
8420306798
1869435865
3950442829
33277496444
368811581
8584683910
1061069533
7614118
8286756629
1869542...

input:

decode
1000
13
399367772
13
2011662233
13
33686908373
13
668792290
13
260796355
13
872402354
13
8480336493
13
381417127
13
8497093333
13
8018881148
13
74710512
13
7512945913
13
49436629
13
62847859
13
936328022
13
1835982198
13
124598115
13
8318773613
13
1602170738
13
8420306798
13
1869435865
13
395...

output:

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

result:

ok 1000 lines

Test #20:

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

input:

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

output:

67108863
0
22369621
16490363374
196600249
7647751132
33552022239
137385204508
68715408116
65755872978
58786747865
137061197468
269421065653
136808750440
12414297
66370354789
67100958185
137320982356
136631202277
270347899881
7489974087
67542760398
67075037583
3581607718
3871133591
804869453
13419581...

input:

decode
1000
14
67108863
14
0
14
22369621
14
16490363374
14
196600249
14
7647751132
14
33552022239
14
137385204508
14
68715408116
14
65755872978
14
58786747865
14
137061197468
14
269421065653
14
136808750440
14
12414297
14
66370354789
14
67100958185
14
137320982356
14
136631202277
14
270347899881
14
...

output:

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

result:

ok 1000 lines

Test #21:

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

input:

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

output:

498173945210
55699491679
201760397022
268363559373
1030755688042
6106488507
252328071995
60027658161
12137772870
4147889826
120118689470
7246530924
4286385793
274863892401
489895036
31667875546
1097690439625
1090560420538
272361094825
274470170220
135262986046
133097434355
115153238898
532558092682
...

input:

decode
1000
15
498173945210
15
55699491679
15
201760397022
15
268363559373
15
1030755688042
15
6106488507
15
252328071995
15
60027658161
15
12137772870
15
4147889826
15
120118689470
15
7246530924
15
4286385793
15
274863892401
15
489895036
15
31667875546
15
1097690439625
15
1090560420538
15
272361094...

output:

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

result:

ok 1000 lines

Test #22:

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

input:

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

output:

1073741823
0
357913941
402916040622
8211762886520
402113533757
1029961563241
4254093015436
8787092913070
548519734524
4397856677545
23066372469
265665760618
3229727178336
859111359
89618505606
4119129399218
17589221614541
469996042715
753726599005
823827193446
67640101721
8777704000714
463807695533
...

input:

decode
1000
16
1073741823
16
0
16
357913941
16
402916040622
16
8211762886520
16
402113533757
16
1029961563241
16
4254093015436
16
8787092913070
16
548519734524
16
4397856677545
16
23066372469
16
265665760618
16
3229727178336
16
859111359
16
89618505606
16
4119129399218
16
17589221614541
16
469996042...

output:

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

result:

ok 1000 lines

Test #23:

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

input:

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

output:

1630676711600
8588961447058
8713816091638
510022929016
2178584061308
68713964551109
8243958954968
531968519153
34078374737549
549108292133
140462322726420
4320651864988
502089640997
34973847006030
372520645901
1074810746855
200648748669
34462381369406
12601198622893
7695070199701
15220280637069
6885...

input:

decode
1000
17
1630676711600
17
8588961447058
17
8713816091638
17
510022929016
17
2178584061308
17
68713964551109
17
8243958954968
17
531968519153
17
34078374737549
17
549108292133
17
140462322726420
17
4320651864988
17
502089640997
17
34973847006030
17
372520645901
17
1074810746855
17
200648748669
...

output:

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

result:

ok 1000 lines

Test #24:

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

input:

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

output:

17179869183
0
5726623061
68030108921678
17384096789222
29548768974204
1090639541170893
526940932208056
1054403599484689
723601046977
51933502944365
275969491286925
68847215491449
14017661166941
26310361939461
527470427077542
780062596792
17576855287353
561395069286890
2024941750413
60737253235659
10...

input:

decode
1000
18
17179869183
18
0
18
5726623061
18
68030108921678
18
17384096789222
18
29548768974204
18
1090639541170893
18
526940932208056
18
1054403599484689
18
723601046977
18
51933502944365
18
275969491286925
18
68847215491449
18
14017661166941
18
26310361939461
18
527470427077542
18
780062596792...

output:

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

result:

ok 1000 lines

Test #25:

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

input:

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

output:

68719476735
0
22906492245
2232813440704334
3921382432915297
122440789071097
2179229579366805
241868396026552
2065973460723145
403486066834521
2251240561073094
3869713368337754
1121223729396443
1037105726974418
11765437953392
4424072366902772
558805300802212
4424159305368763
5477425276817
68626849045...

input:

decode
1000
19
68719476735
19
0
19
22906492245
19
2232813440704334
19
3921382432915297
19
122440789071097
19
2179229579366805
19
241868396026552
19
2065973460723145
19
403486066834521
19
2251240561073094
19
3869713368337754
19
1121223729396443
19
1037105726974418
19
11765437953392
19
442407236690277...

output:

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

result:

ok 1000 lines

Test #26:

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

input:

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

output:

34814364614277621
4875314591518
826694609400048
2111050368224996
69241153664210022
2249242426698990
8416604709676597
8901598352307920
3896289103994580
4494722936262686
67544827798453652
18005532176128994
1037614570434261
17855891055288073
985108309012381
4180031533561
3359977275904695
18292408905851...

input:

decode
1000
20
34814364614277621
20
4875314591518
20
826694609400048
20
2111050368224996
20
69241153664210022
20
2249242426698990
20
8416604709676597
20
8901598352307920
20
3896289103994580
20
4494722936262686
20
67544827798453652
20
18005532176128994
20
1037614570434261
20
17855891055288073
20
9851...

output:

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

result:

ok 1000 lines

Test #27:

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

input:

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

output:

6693481848090020
4190701458508726
576116424538253034
71125169395853145
33492076858901979
281263455703348568
137218637114572550
949415690776489
35809982794392444
35729592181742219
269634709401550617
283717746207938483
141788050067446526
70630359006033740
283652421797206940
26581101291976377
673421150...

input:

decode
1000
21
6693481848090020
21
4190701458508726
21
576116424538253034
21
71125169395853145
21
33492076858901979
21
281263455703348568
21
137218637114572550
21
949415690776489
21
35809982794392444
21
35729592181742219
21
269634709401550617
21
283717746207938483
21
141788050067446526
21
7063035900...

output:

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

result:

ok 1000 lines

Test #28:

score: 0
Wrong Answer on the first run

input:

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

output:

13334601178768057
14038531688946666
1148378180981456714
1143454648757496470
569491958250733196
62971211061655402
4316558284686276428
35881101631719893
24769079338318708
87538436125222029
432287289804691020
2233572517368089019
431768212021883378
287855981419665005
138474674092679370
12602815052508231...

input:


output:


result:

wrong answer Integer parameter [name=x_i] equals to 4316558284686276428, violates the range [0, 2*10^18] (test case 7)