QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#566046#23. Brackets3un_larryfunc100 ✓59ms5496kbC++141.5kb2024-09-15 22:56:022024-09-15 22:56:03

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 16
Accepted

Test #1:

score: 16
Accepted
time: 0ms
memory: 3612kb

input:

10 50 6 8
1 6 {
5 10 <
7 10 [
9 6 [
8 1 (
4 8 <
1 1 <
10 3 [
5 7 [
2 1 (
8 2 <
1 4 [
10 6 <
8 9 >
3 5 <
2 8 <
10 4 {
9 6 (
3 2 [
7 2 [
9 10 ]
3 9 {
6 5 {
8 9 [
9 9 (
3 1 [
8 2 (
1 6 <
5 8 {
1 7 {
9 9 )
7 6 {
3 1 [
7 3 <
5 10 {
2 5 {
7 8 {
10 8 (
2 10 <
2 10 [
4 4 <
1 7 {
8 6 {
10 8 {
1 10 {
3 10 <
9...

output:

28

result:

ok single line: '28'

Test #2:

score: 16
Accepted
time: 0ms
memory: 3600kb

input:

10 12 1 10
4 5 [
9 4 [
4 7 {
2 10 [
1 3 (
8 9 >
10 10 }
10 6 ]
7 4 (
6 10 )
5 2 (
3 8 <

output:

16

result:

ok single line: '16'

Test #3:

score: 16
Accepted
time: 0ms
memory: 3612kb

input:

10 13 6 9
6 7 ]
6 5 )
10 6 (
6 1 >
8 6 [
6 2 }
6 6 <
2 10 }
5 8 )
4 6 {
1 4 >
3 9 ]
7 3 ]

output:

90

result:

ok single line: '90'

Test #4:

score: 16
Accepted
time: 0ms
memory: 3668kb

input:

10 50 4 2
1 9 >
6 6 [
8 9 )
7 1 >
5 4 >
1 6 {
2 7 [
4 7 >
6 8 }
4 6 )
5 3 <
3 1 <
1 9 {
2 3 )
5 5 }
1 1 >
7 10 }
7 10 [
7 6 (
5 2 {
3 1 >
3 6 )
5 3 (
9 8 ]
1 3 ]
7 4 )
10 2 }
8 2 ]
5 4 [
7 5 ]
10 6 {
3 10 >
6 8 )
7 3 )
3 2 ]
8 6 [
10 1 ]
3 7 )
10 4 >
8 4 ]
3 10 <
4 7 (
2 10 ]
5 7 <
9 5 }
1 10 }
6 3 ...

output:

10

result:

ok single line: '10'

Test #5:

score: 16
Accepted
time: 0ms
memory: 3672kb

input:

10 50 5 7
5 7 ]
2 10 (
5 2 >
2 9 }
5 2 )
2 9 [
5 4 {
6 3 )
2 10 (
9 10 >
8 9 [
5 1 (
8 9 }
10 3 )
2 3 <
10 3 )
9 6 <
10 3 ]
6 7 <
2 10 <
1 7 (
3 5 <
9 10 }
2 8 (
6 1 <
9 7 {
10 3 (
9 7 }
8 1 }
5 9 ]
9 3 }
10 4 (
9 4 (
2 4 <
2 1 >
9 7 <
9 7 }
2 8 }
9 7 )
2 1 <
5 8 ]
5 1 (
9 1 >
6 1 [
10 1 {
2 4 <
2 4...

output:

-1

result:

ok single line: '-1'

Test #6:

score: 16
Accepted
time: 0ms
memory: 3696kb

input:

8 11 1 6
8 5 (
1 7 {
4 6 )
1 1 [
3 6 >
7 2 <
1 6 (
2 3 }
5 6 )
6 4 ]
1 8 (

output:

-1

result:

ok single line: '-1'

Test #7:

score: 16
Accepted
time: 0ms
memory: 3672kb

input:

9 16 3 6
6 4 ]
3 8 [
6 3 (
8 1 [
2 2 )
9 9 )
5 5 )
1 7 [
7 4 (
4 4 )
7 3 [
4 5 ]
5 9 ]
9 2 ]
6 6 )
2 6 ]

output:

40

result:

ok single line: '40'

Test #8:

score: 16
Accepted
time: 0ms
memory: 3608kb

input:

10 50 6 7
2 1 {
8 10 (
6 2 <
8 4 ]
4 8 )
6 1 {
5 9 }
4 8 >
2 2 )
1 3 )
4 5 ]
1 5 )
4 6 [
6 2 }
2 8 >
7 3 [
2 1 >
2 7 (
8 7 {
6 4 ]
5 9 {
1 6 ]
2 1 ]
3 2 >
7 8 )
7 4 )
8 9 [
2 5 }
4 7 ]
7 6 }
4 5 )
8 2 ]
9 1 >
7 3 ]
7 2 [
2 6 >
7 8 >
6 6 >
9 5 <
10 2 (
7 6 [
5 1 )
5 3 )
5 2 ]
9 9 (
7 7 [
8 6 >
6 1 ]
...

output:

18

result:

ok single line: '18'

Test #9:

score: 16
Accepted
time: 0ms
memory: 3552kb

input:

9 13 1 5
7 4 }
9 2 >
3 9 <
4 9 [
6 7 {
7 4 <
6 6 }
2 6 )
6 6 [
8 3 (
5 6 <
1 8 [
4 5 ]

output:

8

result:

ok single line: '8'

Test #10:

score: 16
Accepted
time: 0ms
memory: 3644kb

input:

10 36 6 8
7 9 >
5 3 (
1 8 {
9 4 ]
7 3 (
10 7 ]
7 1 {
10 1 )
4 1 >
2 1 (
5 6 (
8 10 (
3 5 )
3 5 )
7 5 <
9 2 [
6 4 (
6 7 <
3 9 (
2 8 }
5 8 [
1 6 >
4 8 ]
6 1 ]
5 9 <
9 7 ]
5 1 <
10 4 <
4 6 {
4 7 }
8 5 <
2 3 <
9 2 <
3 3 [
4 4 <
1 4 {

output:

40

result:

ok single line: '40'

Test #11:

score: 16
Accepted
time: 0ms
memory: 3668kb

input:

10 50 7 1
9 9 ]
6 5 }
6 9 }
2 1 {
7 10 >
3 8 (
6 9 >
1 3 >
9 7 {
10 2 }
9 9 [
10 10 >
9 9 )
6 9 <
5 5 <
2 3 }
5 7 >
6 6 [
2 3 (
4 4 (
2 3 (
5 10 }
2 2 ]
4 4 [
10 1 [
9 5 <
1 3 [
6 5 }
6 5 (
2 1 ]
9 7 ]
3 3 [
3 4 )
10 1 [
8 8 }
5 10 [
2 2 ]
4 6 }
2 3 {
9 9 [
1 8 (
7 2 {
7 7 >
1 8 ]
8 8 (
10 10 )
1 3 ...

output:

22

result:

ok single line: '22'

Test #12:

score: 16
Accepted
time: 0ms
memory: 3600kb

input:

8 12 5 3
5 8 <
7 2 (
5 6 (
8 3 ]
5 1 {
4 5 }
2 4 [
1 3 >
6 3 }
5 7 {
5 3 )
3 3 ]

output:

-1

result:

ok single line: '-1'

Subtask #2:

score: 16
Accepted

Dependency #1:

100%
Accepted

Test #13:

score: 16
Accepted
time: 0ms
memory: 3632kb

input:

20 100 1 15
16 3 )
15 4 }
1 17 [
20 1 )
9 2 }
7 2 )
18 13 }
5 9 ]
12 18 ]
4 14 [
13 1 )
20 2 )
16 2 }
16 3 }
9 2 }
7 2 )
20 18 )
12 8 >
9 12 >
4 12 ]
12 16 >
4 17 ]
19 18 >
11 20 )
14 5 >
12 13 }
12 17 }
1 6 }
5 12 >
19 20 ]
15 5 >
1 20 <
6 8 }
17 6 ]
9 8 ]
6 6 )
20 1 <
8 18 >
9 1 >
1 18 >
16 5 )
2 ...

output:

-1

result:

ok single line: '-1'

Test #14:

score: 16
Accepted
time: 0ms
memory: 3660kb

input:

20 25 12 10
20 10 >
11 11 >
15 7 )
12 6 {
11 5 >
12 13 >
19 14 <
17 20 >
16 18 >
15 4 >
6 15 }
2 19 )
14 12 <
4 11 >
18 17 >
8 2 }
7 8 {
1 16 >
12 3 (
9 12 }
5 1 >
13 4 >
3 9 {
16 1 >
12 10 >

output:

80

result:

ok single line: '80'

Test #15:

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

input:

17 100 13 1
16 10 >
14 3 (
15 7 [
7 3 (
6 9 [
17 10 ]
14 6 <
10 15 ]
8 7 (
16 13 [
3 10 [
6 17 (
3 6 ]
17 12 <
6 11 >
2 13 }
9 7 <
2 10 {
4 8 <
17 14 [
15 13 )
10 12 <
2 15 }
7 1 >
5 7 [
16 16 {
13 17 >
8 13 }
2 10 }
14 14 <
6 13 (
13 8 >
3 8 >
6 9 ]
17 13 )
7 11 )
6 15 <
14 8 (
13 13 {
15 12 [
17 3...

output:

8

result:

ok single line: '8'

Test #16:

score: 16
Accepted
time: 0ms
memory: 3628kb

input:

20 99 5 6
2 3 {
3 13 {
8 6 (
11 3 [
16 12 <
20 14 <
12 11 {
18 18 <
2 10 <
3 11 [
9 13 {
16 9 (
2 19 [
12 7 (
16 7 (
7 3 [
2 20 [
13 13 {
4 20 )
3 5 (
10 9 {
8 14 {
20 18 (
4 13 <
15 15 <
6 11 {
6 10 {
17 13 {
20 14 ]
9 16 (
4 16 [
18 2 [
11 9 {
6 7 (
15 12 (
3 20 (
10 16 (
6 5 <
10 2 (
11 14 <
16 1...

output:

28

result:

ok single line: '28'

Test #17:

score: 16
Accepted
time: 1ms
memory: 3700kb

input:

20 95 11 13
18 10 <
13 7 (
18 10 <
2 2 )
8 16 >
16 3 <
15 4 (
11 9 >
16 9 )
7 1 <
10 6 {
19 5 (
2 3 ]
5 5 >
19 5 <
8 8 ]
15 10 <
9 19 [
13 12 ]
5 8 <
16 8 (
18 16 )
6 1 >
11 9 ]
3 8 [
19 12 [
5 3 [
18 18 [
4 8 >
8 12 [
9 4 }
10 20 <
8 7 >
19 5 {
10 18 ]
7 19 )
14 6 )
16 19 [
7 19 }
6 16 }
14 19 >
18...

output:

22

result:

ok single line: '22'

Test #18:

score: 16
Accepted
time: 0ms
memory: 3540kb

input:

1 0 1 1

output:

0

result:

ok single line: '0'

Test #19:

score: 16
Accepted
time: 0ms
memory: 3620kb

input:

20 23 12 11
2 4 )
17 9 }
14 10 >
19 12 <
20 8 ]
13 7 )
3 14 >
8 19 ]
6 17 }
10 18 >
15 20 ]
12 6 }
12 13 )
4 12 [
16 12 {
12 5 ]
18 16 >
1 11 }
9 1 }
5 15 ]
12 12 (
12 3 >
7 2 )

output:

1310

result:

ok single line: '1310'

Test #20:

score: 16
Accepted
time: 0ms
memory: 3704kb

input:

20 100 10 14
11 6 ]
16 19 >
2 16 >
11 3 <
19 16 }
6 18 }
11 4 >
14 6 ]
7 10 [
18 13 ]
19 11 }
1 17 ]
13 5 >
4 9 ]
10 20 )
14 3 >
11 9 )
3 12 )
8 13 {
11 12 >
20 18 )
2 20 >
10 12 )
8 12 >
13 7 {
20 19 )
10 16 )
17 16 ]
9 6 ]
16 17 }
2 3 )
13 10 }
18 11 )
17 10 ]
8 7 )
20 1 }
3 20 ]
10 18 >
16 15 ]
5...

output:

24

result:

ok single line: '24'

Test #21:

score: 16
Accepted
time: 1ms
memory: 3700kb

input:

20 93 14 18
20 19 }
19 18 <
2 10 (
17 18 [
10 7 >
10 17 {
3 12 <
15 1 }
17 8 {
5 3 >
12 3 {
8 5 <
1 10 (
13 5 (
10 19 ]
2 6 >
7 2 )
12 12 }
20 1 {
12 20 )
19 13 >
13 2 [
8 1 {
16 6 <
8 16 )
6 14 (
7 10 }
10 11 <
19 14 ]
14 10 ]
17 16 <
9 12 ]
20 7 }
18 16 {
18 9 )
10 4 [
5 9 ]
9 12 (
20 13 {
6 10 (
...

output:

22

result:

ok single line: '22'

Test #22:

score: 16
Accepted
time: 1ms
memory: 3860kb

input:

20 97 3 4
20 16 >
9 20 >
20 15 [
2 9 {
14 11 }
6 9 }
14 3 <
11 4 (
18 16 ]
10 17 )
11 3 )
2 18 [
12 2 >
6 14 <
16 10 {
17 9 (
11 17 }
19 11 )
8 8 {
16 17 }
9 12 {
8 19 )
2 11 >
20 16 <
13 7 >
9 17 }
6 14 {
3 7 }
6 13 )
18 14 (
12 8 [
17 5 <
15 10 }
12 17 {
8 2 <
4 13 {
4 14 [
2 11 <
7 19 {
18 16 >
2...

output:

16

result:

ok single line: '16'

Test #23:

score: 16
Accepted
time: 0ms
memory: 3620kb

input:

20 24 20 3
9 20 {
8 8 }
4 18 (
6 19 (
14 2 {
3 3 }
3 8 )
13 9 {
18 10 {
16 6 {
7 17 {
20 1 {
8 2 )
19 12 {
5 14 {
17 16 {
5 4 {
10 11 {
15 13 (
2 3 )
12 5 {
1 7 (
11 15 {
2 2 }

output:

84

result:

ok single line: '84'

Test #24:

score: 16
Accepted
time: 0ms
memory: 3692kb

input:

20 100 19 6
2 2 ]
1 19 >
9 15 {
13 16 >
7 7 (
1 2 [
6 6 <
9 5 [
18 18 <
3 3 >
19 10 >
15 12 ]
14 13 [
14 13 <
18 7 }
8 4 >
18 18 >
12 12 (
3 14 (
18 7 (
2 2 (
12 20 [
16 16 {
11 9 )
8 4 )
6 13 >
13 17 >
14 6 {
14 14 }
12 12 (
10 7 <
2 19 ]
14 13 )
4 4 <
1 1 ]
20 6 ]
9 15 (
8 11 {
2 18 [
13 17 )
12 3...

output:

26

result:

ok single line: '26'

Subtask #3:

score: 16
Accepted

Dependency #2:

100%
Accepted

Test #25:

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

input:

44 94 23 7
20 12 (
33 13 {
41 8 )
16 38 )
27 18 [
7 16 )
22 13 )
26 26 [
42 42 ]
9 9 ]
31 31 ]
34 34 ]
5 31 )
28 28 [
40 23 (
35 35 ]
29 22 )
39 27 (
14 14 ]
14 6 >
39 35 )
44 44 [
22 26 {
7 7 ]
21 21 ]
38 30 )
25 28 (
5 5 ]
14 21 )
44 3 (
36 32 (
23 2 (
24 24 [
2 2 [
36 36 [
12 12 [
10 10 ]
37 6 (
...

output:

232

result:

ok single line: '232'

Test #26:

score: 16
Accepted
time: 2ms
memory: 4080kb

input:

50 280 13 25
26 25 (
18 30 )
28 8 >
43 33 }
34 2 [
2 33 }
35 5 }
21 41 >
1 31 [
50 18 <
36 5 }
31 33 <
37 14 }
50 39 }
14 41 >
27 44 >
16 7 }
50 44 {
32 14 <
13 8 >
1 47 <
18 16 [
20 36 >
18 50 >
7 50 <
30 15 [
13 15 >
15 22 [
36 10 }
16 36 ]
22 33 )
34 30 (
16 15 >
49 48 >
49 32 [
35 30 [
2 43 )
30...

output:

18

result:

ok single line: '18'

Test #27:

score: 16
Accepted
time: 5ms
memory: 3796kb

input:

50 2000 25 13
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
13 9 )
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
27 27 [
32 32 [
27 27 [
27 27 [
27 27 [
27 27 [...

output:

9942

result:

ok single line: '9942'

Test #28:

score: 16
Accepted
time: 1ms
memory: 3932kb

input:

50 58 48 49
26 47 [
8 8 <
5 12 )
14 43 >
32 31 {
30 21 >
48 8 (
29 5 )
16 33 (
8 45 [
31 39 }
37 2 }
44 41 {
12 49 )
10 19 ]
15 42 [
15 14 >
13 44 (
43 45 (
14 38 (
50 38 )
31 36 >
47 17 ]
36 30 <
43 35 <
43 16 [
39 43 ]
41 42 }
38 26 )
45 48 )
47 13 {
1 13 (
16 41 >
19 50 (
45 1 ]
1 37 {
11 32 <
3 ...

output:

14

result:

ok single line: '14'

Test #29:

score: 16
Accepted
time: 2ms
memory: 3840kb

input:

50 610 7 16
7 30 )
8 48 (
18 13 }
39 10 ]
25 29 <
6 40 {
24 42 [
43 2 )
27 45 (
18 14 <
27 24 }
7 4 ]
28 35 )
10 26 (
7 40 (
48 6 ]
47 23 }
49 50 }
49 25 ]
29 25 }
24 38 >
47 35 ]
16 5 [
22 40 }
30 17 [
19 34 >
21 27 >
35 42 {
38 43 }
31 30 <
14 34 [
23 32 {
24 42 )
36 1 (
33 50 ]
33 1 }
5 43 (
28 4...

output:

-1

result:

ok single line: '-1'

Test #30:

score: 16
Accepted
time: 8ms
memory: 4120kb

input:

50 2000 22 12
15 24 [
43 14 )
17 3 {
20 29 )
15 40 (
4 14 {
40 36 ]
43 24 >
39 39 >
44 23 <
40 34 >
23 23 <
32 21 >
49 13 ]
49 17 )
46 8 ]
17 46 ]
33 37 {
4 31 }
36 11 ]
46 8 <
16 16 >
15 29 ]
16 31 )
46 32 >
31 34 [
44 28 }
47 6 >
25 25 }
19 33 >
9 50 >
15 31 <
23 9 ]
36 36 {
15 31 <
34 11 (
42 6 (...

output:

10

result:

ok single line: '10'

Test #31:

score: 16
Accepted
time: 0ms
memory: 3748kb

input:

50 76 43 19
35 18 }
9 29 }
42 37 }
24 49 )
50 8 (
21 21 {
7 9 )
36 38 (
28 28 {
46 21 [
11 25 )
47 10 )
28 5 (
40 28 [
31 31 ]
30 34 )
11 11 ]
19 19 ]
17 2 )
38 48 [
18 6 )
3 4 (
7 7 ]
4 36 [
29 35 )
18 18 ]
32 32 ]
2 31 }
50 50 {
22 19 }
12 13 )
10 30 }
29 29 ]
45 16 [
26 24 }
13 27 }
48 46 (
27 27...

output:

848

result:

ok single line: '848'

Test #32:

score: 16
Accepted
time: 0ms
memory: 3944kb

input:

50 100 11 17
50 35 {
46 8 <
4 1 }
4 9 (
30 4 {
5 5 {
39 28 {
3 22 {
48 40 {
26 28 {
4 39 {
37 46 {
35 36 {
38 25 (
28 23 [
27 6 (
30 46 <
16 19 (
30 16 {
35 23 <
18 30 <
21 38 <
28 31 [
36 22 (
13 36 (
22 49 (
38 44 (
6 28 <
43 16 {
17 29 [
17 1 ]
28 22 <
27 46 (
31 27 <
32 8 <
27 10 [
2 25 <
24 2 {...

output:

40

result:

ok single line: '40'

Test #33:

score: 16
Accepted
time: 1ms
memory: 3812kb

input:

50 204 36 14
20 46 <
31 33 }
9 8 ]
21 17 [
6 25 ]
25 45 )
21 38 )
8 18 )
44 41 >
28 38 {
46 9 )
36 39 ]
31 3 }
44 19 >
28 18 }
43 49 <
44 34 >
47 25 )
19 19 )
41 19 ]
35 44 <
30 36 (
45 4 >
29 10 <
20 31 )
9 6 )
2 16 )
25 29 ]
7 43 ]
1 49 <
16 26 {
26 41 [
10 18 )
42 12 [
26 4 >
42 33 {
31 16 <
40 1...

output:

12

result:

ok single line: '12'

Test #34:

score: 16
Accepted
time: 0ms
memory: 3968kb

input:

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

output:

98

result:

ok single line: '98'

Test #35:

score: 16
Accepted
time: 8ms
memory: 3968kb

input:

50 2000 21 44
2 19 [
27 11 [
1 29 )
48 47 <
8 44 (
25 41 (
15 16 [
36 5 [
37 50 [
50 15 ]
21 22 <
12 26 )
13 24 [
47 20 (
7 7 {
15 26 )
23 14 ]
1 14 [
34 3 >
29 36 >
30 6 )
10 48 >
41 39 ]
44 42 (
8 7 )
25 22 ]
11 24 }
41 45 )
20 37 )
37 12 <
2 17 >
10 10 <
39 23 ]
17 4 >
4 41 <
19 27 }
47 16 }
6 30...

output:

2

result:

ok single line: '2'

Test #36:

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

input:

50 666 20 18
49 49 ]
40 40 (
1 19 (
34 5 )
2 2 }
20 20 }
42 33 [
18 25 {
34 34 [
17 17 }
37 11 <
7 7 <
46 8 (
32 29 ]
40 40 (
49 49 (
22 26 {
14 15 {
6 31 {
41 5 >
4 29 [
48 35 <
6 31 >
17 17 {
28 22 }
37 48 }
18 25 (
23 19 (
5 5 <
35 35 )
23 19 {
8 8 <
26 26 <
5 40 )
38 38 <
16 28 [
22 26 }
6 6 (
8...

output:

30

result:

ok single line: '30'

Subtask #4:

score: 16
Accepted

Dependency #3:

100%
Accepted

Test #37:

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

input:

100 143 52 5
5 24 >
62 35 [
78 60 )
79 76 ]
6 46 [
66 50 )
19 43 )
43 65 )
21 53 {
75 74 )
37 37 (
40 40 (
13 80 )
9 39 )
63 63 (
86 68 [
50 90 )
7 31 )
93 16 [
76 17 )
8 51 )
70 98 [
15 54 [
25 87 [
54 64 [
57 33 [
41 4 [
71 22 <
51 34 )
12 5 ]
23 32 [
85 85 (
74 14 ]
90 18 )
85 36 [
20 94 <
52 45 ...

output:

115038

result:

ok single line: '115038'

Test #38:

score: 16
Accepted
time: 12ms
memory: 4252kb

input:

100 2000 91 69
73 95 ]
98 25 (
25 82 >
40 50 (
74 52 >
86 91 {
2 27 }
69 13 )
38 48 {
10 4 ]
48 49 (
35 67 )
82 82 [
30 70 >
12 22 ]
41 82 }
88 64 (
50 99 [
26 47 >
81 49 }
3 34 <
77 48 [
11 34 ]
29 24 >
60 23 )
60 50 {
75 99 (
53 81 (
2 40 <
64 80 {
4 44 ]
33 40 >
15 70 ]
54 82 )
71 62 {
76 68 }
68...

output:

4

result:

ok single line: '4'

Test #39:

score: 16
Accepted
time: 0ms
memory: 3760kb

input:

100 500 63 90
53 52 [
70 56 {
2 14 (
85 32 [
99 81 [
18 51 {
100 61 {
86 56 [
86 5 {
23 9 [
24 86 (
8 12 {
51 5 (
30 18 (
90 13 )
96 72 (
68 9 [
49 92 {
86 95 {
72 15 [
58 87 [
92 7 {
93 63 [
54 59 {
40 75 {
99 60 (
6 46 {
36 77 {
36 4 [
50 73 <
56 83 [
13 71 >
26 82 {
42 48 (
5 59 {
12 24 (
44 68 [...

output:

28

result:

ok single line: '28'

Test #40:

score: 16
Accepted
time: 0ms
memory: 3768kb

input:

100 200 37 48
56 12 <
32 81 {
47 86 (
74 24 )
71 13 ]
89 5 [
23 92 [
17 24 )
69 30 ]
29 86 (
13 33 ]
14 4 }
26 56 }
75 33 (
20 31 (
100 81 }
30 60 {
94 86 ]
59 68 }
87 38 ]
57 69 [
6 48 }
33 38 <
45 67 [
20 92 }
47 40 [
89 4 {
4 41 <
77 66 )
40 41 (
92 68 {
100 85 [
64 51 ]
98 12 <
6 77 [
92 97 )
29...

output:

10

result:

ok single line: '10'

Test #41:

score: 16
Accepted
time: 13ms
memory: 4008kb

input:

100 2000 13 66
78 50 }
73 51 )
83 80 [
12 42 ]
77 30 (
13 51 {
51 89 {
82 35 <
80 68 [
40 51 {
28 5 >
99 89 ]
85 4 }
30 32 }
90 27 [
93 76 }
41 61 {
30 56 )
82 52 )
91 61 {
55 23 >
13 66 >
30 18 >
79 46 {
83 44 }
76 73 )
61 66 (
36 28 [
64 26 {
89 97 [
47 49 [
57 87 {
51 3 )
58 67 >
97 17 [
14 47 (
...

output:

4

result:

ok single line: '4'

Test #42:

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

input:

100 300 38 99
31 31 {
76 9 [
66 66 {
11 61 {
77 34 ]
94 29 ]
81 85 (
22 95 <
77 77 }
63 42 (
18 17 )
45 68 ]
74 50 <
71 71 <
85 85 (
64 89 <
87 74 >
78 78 >
78 15 ]
30 30 ]
65 65 >
36 36 }
97 55 >
20 58 }
23 23 {
72 72 )
54 60 ]
70 70 )
28 23 {
65 65 [
46 46 )
29 29 (
28 28 }
63 42 ]
8 8 [
83 30 (
1...

output:

18

result:

ok single line: '18'

Test #43:

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

input:

98 120 54 43
7 79 >
35 21 {
86 35 {
3 65 {
25 16 <
38 39 {
16 17 <
17 45 [
69 62 }
43 32 }
47 87 <
75 31 <
71 76 ]
72 95 (
54 22 <
76 71 )
59 34 [
59 71 [
10 51 )
80 70 {
91 7 >
30 28 <
31 82 [
97 27 <
39 20 {
95 67 {
30 34 )
45 73 <
55 83 {
4 58 {
83 84 {
6 25 <
52 60 <
78 50 {
65 5 {
43 63 >
29 78...

output:

952

result:

ok single line: '952'

Test #44:

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

input:

99 127 14 52
79 73 [
70 67 )
30 36 [
6 77 <
58 58 (
71 71 (
14 4 >
55 88 [
98 7 }
44 41 [
22 42 [
12 30 [
26 94 >
3 16 [
6 1 )
87 34 {
94 32 >
41 10 {
46 46 (
36 58 {
15 62 }
53 92 ]
63 20 [
21 69 >
18 11 {
76 92 }
4 23 >
66 54 )
19 66 ]
95 44 [
73 47 {
80 46 {
37 37 (
53 35 )
86 86 (
28 72 [
78 78 ...

output:

3488

result:

ok single line: '3488'

Test #45:

score: 16
Accepted
time: 8ms
memory: 4036kb

input:

100 2000 90 84
35 20 >
21 67 [
55 75 {
43 92 ]
58 61 [
61 17 <
77 67 {
83 33 ]
74 39 >
26 52 {
46 37 (
19 99 }
32 45 ]
36 85 (
35 57 )
44 15 }
89 81 )
10 79 (
33 77 ]
30 13 )
71 43 {
89 87 (
28 7 (
97 29 [
96 69 }
4 92 <
97 48 [
19 15 )
35 22 {
76 73 )
97 36 <
59 81 (
45 36 >
6 50 (
55 90 )
23 21 }
...

output:

4

result:

ok single line: '4'

Test #46:

score: 16
Accepted
time: 12ms
memory: 4056kb

input:

100 2000 40 14
32 38 ]
62 62 }
33 75 <
2 3 )
11 95 [
31 23 }
20 45 {
73 64 }
15 52 (
49 79 <
49 75 [
21 98 {
74 78 [
47 85 >
54 92 <
94 100 {
76 10 {
10 39 ]
20 38 ]
82 62 ]
29 94 )
15 80 {
51 62 [
60 21 {
85 52 [
69 70 {
89 32 (
79 67 )
22 97 {
30 7 }
56 52 }
19 63 [
31 8 <
78 95 }
57 91 (
87 23 <
...

output:

6

result:

ok single line: '6'

Test #47:

score: 16
Accepted
time: 1ms
memory: 3928kb

input:

100 553 80 4
90 7 <
2 47 <
56 78 {
90 89 {
46 44 >
83 28 (
58 99 [
27 38 {
98 58 [
73 85 [
45 12 [
44 7 )
13 97 {
61 93 [
89 12 [
37 88 <
48 48 <
9 42 {
20 54 <
91 64 (
51 44 }
6 38 (
69 2 <
59 93 {
34 64 {
81 70 {
93 62 [
62 8 [
89 69 {
29 78 [
51 85 [
46 98 (
25 31 [
65 44 >
74 12 {
98 95 <
45 42 ...

output:

20

result:

ok single line: '20'

Test #48:

score: 16
Accepted
time: 15ms
memory: 4060kb

input:

100 2000 36 87
86 100 (
53 31 [
91 91 ]
63 19 [
52 16 {
41 35 [
2 1 [
50 42 }
5 5 {
94 3 {
80 77 [
10 10 >
85 53 (
36 50 )
59 81 [
99 99 <
79 79 [
96 96 ]
59 81 {
86 69 <
100 69 <
69 69 [
30 30 >
63 77 )
78 90 ]
23 65 }
54 65 [
16 47 <
19 19 {
99 65 >
91 92 >
69 63 <
22 55 {
21 100 }
76 4 <
60 99 }
...

output:

36

result:

ok single line: '36'

Test #49:

score: 16
Accepted
time: 1ms
memory: 4024kb

input:

79 80 77 34
20 36 ]
42 37 ]
19 26 ]
11 74 [
46 33 ]
10 5 ]
38 62 ]
47 19 ]
49 54 ]
53 50 ]
40 7 [
33 30 ]
56 10 ]
27 42 ]
2 11 [
18 63 ]
8 51 >
41 43 ]
65 68 ]
70 55 [
68 24 ]
61 39 ]
66 67 ]
74 35 [
69 65 ]
12 78 [
31 69 ]
55 52 [
51 31 ]
35 75 [
71 53 ]
13 28 [
40 8 <
64 9 ]
30 79 ]
62 76 ]
5 22 ]...

output:

-1

result:

ok single line: '-1'

Subtask #5:

score: 10
Accepted

Test #50:

score: 10
Accepted
time: 15ms
memory: 4180kb

input:

200 2000 1 200
135 138 {
126 129 [
167 169 >
195 198 ]
187 188 (
66 70 )
61 65 <
13 14 {
193 196 [
188 190 )
4 5 <
137 140 ]
32 34 ]
87 91 (
103 107 )
182 186 >
168 169 <
101 104 (
193 196 <
36 37 }
109 110 (
141 145 [
33 34 <
192 194 ]
34 38 <
176 178 ]
145 146 <
90 94 [
152 156 ]
81 84 }
9 13 >
83...

output:

52

result:

ok single line: '52'

Test #51:

score: 10
Accepted
time: 15ms
memory: 4456kb

input:

199 2000 1 199
27 28 }
58 59 <
41 42 ]
169 171 {
132 133 {
97 100 (
146 147 [
139 141 }
45 49 ]
174 178 (
189 192 [
41 42 (
90 94 {
179 181 {
106 108 )
106 108 [
120 123 {
58 59 <
162 164 }
162 165 )
114 115 {
1 3 {
110 112 )
156 159 )
67 71 [
12 16 <
145 146 (
25 27 )
16 20 )
174 175 [
9 11 <
144 1...

output:

52

result:

ok single line: '52'

Test #52:

score: 10
Accepted
time: 14ms
memory: 4172kb

input:

198 2000 1 198
150 152 [
195 196 )
146 150 }
132 134 >
163 164 [
115 118 <
32 34 {
127 131 ]
77 79 >
16 18 >
168 172 )
112 115 {
71 72 (
51 55 [
179 183 )
86 89 {
78 82 >
8 11 [
4 8 (
140 141 >
49 51 ]
91 94 (
185 189 [
178 182 ]
48 52 )
12 14 (
160 164 )
16 20 >
75 79 ]
170 173 [
196 197 <
186 188 ...

output:

52

result:

ok single line: '52'

Test #53:

score: 10
Accepted
time: 15ms
memory: 4168kb

input:

197 2000 1 197
66 70 ]
52 55 }
32 35 )
161 163 }
53 54 <
111 113 ]
140 144 (
190 191 >
7 10 (
35 39 <
145 146 >
127 128 ]
120 123 ]
57 59 ]
58 61 (
14 18 >
194 197 [
1 2 {
75 77 [
179 183 [
117 119 >
116 117 <
87 88 (
90 94 )
78 82 >
17 21 )
154 158 }
104 105 [
5 9 )
158 160 ]
104 105 <
4 8 }
47 51 ...

output:

54

result:

ok single line: '54'

Test #54:

score: 10
Accepted
time: 14ms
memory: 4160kb

input:

196 2000 1 196
20 25 ]
126 128 <
183 185 >
39 44 (
188 191 (
79 84 }
171 176 <
15 20 )
32 35 {
50 52 <
160 161 [
133 135 (
149 153 {
112 115 >
182 184 (
165 169 [
53 54 (
185 189 (
43 44 )
193 195 {
83 85 )
154 155 [
34 36 }
26 28 ]
83 87 [
106 110 }
194 195 ]
150 154 {
97 99 ]
114 115 <
161 166 <
5...

output:

42

result:

ok single line: '42'

Test #55:

score: 10
Accepted
time: 14ms
memory: 4160kb

input:

195 2000 1 195
126 129 <
97 98 (
111 113 ]
144 148 ]
25 28 )
10 11 {
173 175 [
124 128 }
146 151 [
10 14 ]
90 91 {
60 65 {
160 162 >
149 154 )
29 34 (
170 171 )
86 89 ]
144 145 <
32 36 <
114 118 (
32 35 [
163 166 }
126 128 <
162 164 )
26 29 {
162 165 [
21 22 <
188 189 (
14 17 )
33 38 >
12 13 <
125 1...

output:

42

result:

ok single line: '42'

Test #56:

score: 10
Accepted
time: 14ms
memory: 4184kb

input:

194 2000 1 194
33 35 >
173 175 }
2 3 }
6 7 {
136 138 }
105 107 (
129 132 }
9 11 ]
124 126 ]
84 88 [
88 89 >
175 178 ]
103 106 ]
8 10 {
52 54 >
183 187 >
26 27 {
140 143 [
185 190 {
109 112 <
72 75 <
164 169 )
6 11 {
94 96 ]
3 6 >
124 125 <
154 158 (
84 88 ]
17 22 ]
112 116 (
100 105 <
24 25 <
33 38 ...

output:

42

result:

ok single line: '42'

Test #57:

score: 10
Accepted
time: 11ms
memory: 4416kb

input:

200 2000 1 200
19 23 (
199 200 ]
138 140 )
195 200 >
144 149 ]
167 170 >
33 37 )
138 139 >
148 152 >
61 65 }
22 26 ]
134 135 >
166 171 {
109 113 [
183 188 >
74 75 [
103 108 >
98 103 {
15 18 >
28 29 [
15 20 (
197 200 >
12 17 ]
103 107 {
27 29 ]
1 5 >
47 48 {
149 154 }
9 11 {
45 48 )
20 22 <
101 102 >...

output:

44

result:

ok single line: '44'

Test #58:

score: 10
Accepted
time: 15ms
memory: 4160kb

input:

199 2000 1 199
92 97 (
157 162 >
108 113 >
94 99 [
89 93 >
131 137 ]
117 123 >
64 70 (
139 141 (
105 106 {
2 4 {
120 124 {
28 34 >
43 49 <
171 172 >
160 163 )
118 119 }
169 173 (
3 5 [
48 53 {
66 71 }
197 199 ]
41 44 )
165 167 <
97 100 {
41 46 (
144 147 [
159 160 )
35 41 <
126 128 )
93 95 <
7 10 (
1...

output:

36

result:

ok single line: '36'

Test #59:

score: 10
Accepted
time: 15ms
memory: 4360kb

input:

198 2000 1 198
23 28 )
152 157 {
177 183 ]
58 61 (
85 87 )
51 52 [
142 148 ]
66 72 {
14 17 {
112 113 {
14 19 (
83 89 ]
79 84 [
139 140 >
83 88 <
194 198 <
44 45 (
157 163 <
106 107 (
142 145 (
65 71 ]
23 29 }
10 12 [
18 23 {
1 3 (
141 146 {
105 109 ]
104 107 <
62 68 {
36 42 {
124 127 <
98 103 )
180 ...

output:

38

result:

ok single line: '38'

Test #60:

score: 10
Accepted
time: 11ms
memory: 4192kb

input:

197 2000 1 197
81 82 {
121 125 [
131 134 }
47 53 ]
86 92 {
5 9 {
28 31 }
33 38 [
36 39 }
180 182 )
143 144 ]
180 186 >
98 101 )
61 64 )
148 150 <
102 106 [
59 64 ]
18 22 [
58 61 ]
159 160 <
21 27 >
44 50 )
30 34 >
133 135 <
178 180 <
182 183 }
13 19 >
24 27 [
98 104 <
144 148 }
72 73 ]
98 103 {
148 ...

output:

36

result:

ok single line: '36'

Test #61:

score: 10
Accepted
time: 14ms
memory: 4164kb

input:

196 2000 1 196
93 95 }
66 71 >
121 124 (
66 68 {
133 137 [
164 165 )
4 10 {
161 167 <
107 111 ]
24 28 (
159 163 }
172 178 {
176 177 >
151 152 }
145 147 <
134 139 )
110 115 )
20 25 {
138 140 {
33 34 [
59 62 {
193 194 >
46 49 }
138 144 {
191 192 }
116 117 ]
35 38 )
110 114 {
175 179 {
38 41 [
113 118 ...

output:

36

result:

ok single line: '36'

Test #62:

score: 10
Accepted
time: 14ms
memory: 4232kb

input:

195 2000 1 195
75 81 }
153 155 )
156 161 <
181 185 >
77 81 <
25 29 >
115 121 (
36 42 (
84 88 <
153 154 >
151 156 (
42 47 [
158 162 [
194 195 [
102 105 ]
146 149 <
191 193 <
83 85 (
83 89 <
30 31 )
44 51 [
193 194 ]
75 77 <
161 162 <
88 95 )
187 188 <
18 21 {
44 51 >
11 12 <
187 193 ]
56 63 ]
180 187...

output:

30

result:

ok single line: '30'

Test #63:

score: 10
Accepted
time: 2ms
memory: 4120kb

input:

200 2000 1 200
48 95 >
49 115 >
37 118 }
28 55 )
62 114 <
115 129 >
62 104 <
60 160 >
55 154 (
115 200 {
62 125 [
140 151 (
130 141 <
75 177 {
144 187 >
38 67 >
178 186 }
132 148 )
41 146 >
44 81 ]
8 11 ]
105 193 ]
37 179 [
49 171 }
70 105 >
8 22 >
30 196 ]
29 98 <
109 158 [
45 128 ]
16 133 >
68 162...

output:

2

result:

ok single line: '2'

Test #64:

score: 10
Accepted
time: 2ms
memory: 4124kb

input:

200 2000 1 200
8 28 {
157 174 <
174 192 [
30 135 (
16 60 [
104 148 }
55 60 (
116 141 ]
118 158 ]
59 135 (
84 124 [
20 196 (
127 146 <
67 77 >
43 168 <
23 84 >
23 85 )
66 167 }
151 187 ]
20 119 <
1 39 [
91 199 (
6 158 <
22 83 >
23 75 (
95 110 [
69 75 {
59 121 >
129 142 (
141 154 >
2 141 <
6 145 (
110...

output:

8

result:

ok single line: '8'

Test #65:

score: 10
Accepted
time: 1ms
memory: 4004kb

input:

200 200 1 200
127 128 <
15 18 }
122 124 (
9 12 (
64 66 <
170 171 [
89 90 >
1 2 }
53 56 }
157 158 (
20 23 )
175 178 (
25 26 <
91 93 }
177 180 {
195 197 }
34 35 ]
171 174 ]
82 85 )
82 85 (
13 16 [
49 51 <
164 167 }
176 178 >
50 51 ]
161 164 ]
151 153 }
92 95 ]
40 41 ]
102 103 >
106 109 (
7 10 (
30 31 ...

output:

-1

result:

ok single line: '-1'

Subtask #6:

score: 26
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #66:

score: 26
Accepted
time: 1ms
memory: 4052kb

input:

200 2000 162 114
34 69 ]
196 92 >
12 153 }
33 33 }
105 65 >
182 128 ]
24 188 )
120 71 }
135 148 }
129 8 }
73 79 >
186 130 ]
36 105 )
56 131 ]
38 92 ]
15 59 }
179 102 ]
181 33 }
79 54 )
180 14 >
165 57 >
171 60 >
23 72 )
52 98 >
26 19 ]
46 79 >
85 64 )
3 127 }
174 117 ]
117 12 }
1 12 )
1 197 }
175 10...

output:

-1

result:

ok single line: '-1'

Test #67:

score: 26
Accepted
time: 57ms
memory: 4548kb

input:

200 2000 130 89
90 90 <
50 98 }
43 43 )
171 137 (
46 58 [
66 46 {
195 195 >
4 4 )
31 153 ]
106 189 )
151 161 }
37 164 >
39 160 <
79 75 >
38 102 )
37 37 )
156 9 ]
85 25 ]
107 116 (
182 51 {
48 194 >
150 33 }
198 52 [
98 98 >
149 145 ]
158 148 ]
163 67 }
117 117 [
172 8 [
197 197 (
134 7 ]
117 142 [
1...

output:

58

result:

ok single line: '58'

Test #68:

score: 26
Accepted
time: 56ms
memory: 4544kb

input:

200 2000 14 200
84 69 [
24 24 >
76 137 [
88 188 [
87 114 >
86 66 >
171 136 >
93 17 [
42 42 {
92 104 )
39 143 }
62 4 (
61 34 (
190 17 {
127 31 <
142 142 {
145 58 )
46 135 <
49 49 )
126 96 (
140 140 }
78 22 (
63 170 (
112 66 (
3 150 )
134 119 (
73 73 ]
133 133 )
93 93 {
65 133 [
147 168 {
61 34 ]
68 1...

output:

58

result:

ok single line: '58'

Test #69:

score: 26
Accepted
time: 52ms
memory: 4780kb

input:

200 2000 45 80
174 166 )
132 129 )
19 111 {
150 150 <
37 83 )
63 63 <
114 114 }
129 62 >
22 22 }
110 53 (
63 63 >
8 132 >
140 14 >
200 46 ]
150 149 )
71 71 [
13 63 }
58 141 <
40 113 ]
88 37 {
76 145 [
77 122 [
108 86 )
147 74 }
175 175 <
175 117 >
41 41 )
57 57 <
7 7 <
165 165 (
15 178 }
73 70 {
60 ...

output:

58

result:

ok single line: '58'

Test #70:

score: 26
Accepted
time: 2ms
memory: 4144kb

input:

200 2000 151 89
125 63 (
169 8 [
133 101 (
3 16 (
130 3 (
107 176 {
167 40 [
120 118 {
76 38 [
2 192 (
117 126 [
176 37 {
34 12 {
47 159 (
101 163 <
159 142 [
156 134 (
48 179 <
77 153 {
18 86 <
160 183 (
2 118 (
105 122 [
177 100 {
94 149 [
160 171 {
128 38 (
115 125 {
131 6 {
5 17 {
17 179 {
181 1...

output:

22

result:

ok single line: '22'

Test #71:

score: 26
Accepted
time: 2ms
memory: 4004kb

input:

199 259 126 83
34 69 )
178 57 }
153 85 }
102 102 {
195 195 {
51 38 )
168 93 }
14 142 }
154 8 [
7 122 )
99 163 )
79 180 }
135 143 }
67 67 ]
56 141 }
90 126 (
190 102 (
159 179 [
168 168 ]
163 163 ]
84 84 {
104 37 (
79 79 ]
96 101 [
118 148 [
84 75 [
145 13 }
111 157 [
15 194 )
148 150 [
76 83 )
11 11...

output:

9088

result:

ok single line: '9088'

Test #72:

score: 26
Accepted
time: 54ms
memory: 5264kb

input:

200 2000 140 84
53 116 (
115 154 }
160 8 )
69 152 [
113 112 <
63 155 }
154 66 )
124 138 {
64 57 {
29 65 (
106 36 {
176 136 {
27 142 ]
2 16 <
161 184 (
140 35 ]
17 113 [
128 42 [
50 47 )
64 167 )
173 167 )
154 48 ]
1 161 (
45 68 [
35 170 }
64 188 }
182 94 ]
91 106 >
83 187 ]
59 131 [
76 98 }
51 94 {
...

output:

6

result:

ok single line: '6'

Test #73:

score: 26
Accepted
time: 54ms
memory: 5276kb

input:

200 2000 38 13
131 165 >
152 104 )
41 131 (
148 45 )
62 17 )
20 187 ]
107 162 >
91 135 [
184 76 >
137 117 <
63 156 {
123 198 )
178 81 (
155 76 >
68 99 [
176 145 <
6 35 [
33 105 {
80 52 >
186 190 >
169 140 {
124 3 )
187 58 {
124 20 <
101 146 }
47 125 <
9 2 ]
101 91 >
138 15 (
88 24 (
153 75 )
159 67 ...

output:

-1

result:

ok single line: '-1'

Test #74:

score: 26
Accepted
time: 3ms
memory: 4260kb

input:

199 330 126 69
163 163 ]
47 47 ]
27 198 }
135 135 ]
38 38 ]
10 117 }
46 175 [
48 48 ]
135 174 }
101 139 }
150 150 ]
165 165 ]
6 44 }
18 18 ]
4 28 }
38 71 }
76 193 }
108 191 }
13 13 ]
12 12 ]
104 95 {
149 72 [
177 177 ]
17 17 ]
31 140 }
143 87 [
125 111 }
164 158 }
71 85 }
179 110 }
34 9 >
15 37 }
66...

output:

27280

result:

ok single line: '27280'

Test #75:

score: 26
Accepted
time: 59ms
memory: 4552kb

input:

200 2000 42 140
118 130 >
14 76 }
6 73 )
17 64 {
26 28 {
76 2 <
50 181 >
144 144 {
102 131 <
39 79 )
20 79 {
7 163 }
170 52 ]
113 172 (
15 15 [
170 16 }
37 50 <
56 126 )
58 171 }
120 197 (
170 138 >
158 188 {
114 90 ]
13 83 {
146 94 }
186 4 <
167 84 ]
25 70 >
98 54 }
87 87 <
85 12 ]
197 70 [
144 40 ...

output:

28

result:

ok single line: '28'

Test #76:

score: 26
Accepted
time: 2ms
memory: 4104kb

input:

200 2000 30 24
103 167 ]
56 134 ]
98 167 ]
144 29 )
18 101 ]
135 57 ]
196 103 >
73 195 >
131 76 )
137 196 ]
72 185 )
55 139 ]
82 30 )
73 199 >
53 184 >
199 59 }
79 65 >
200 136 }
190 15 >
26 132 }
20 117 )
118 4 )
136 1 >
75 83 >
188 154 )
94 197 ]
19 113 ]
85 67 )
145 30 [
110 1 ]
153 175 >
151 12 ...

output:

16

result:

ok single line: '16'

Test #77:

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

input:

155 156 114 51
74 20 [
32 2 <
45 9 ]
41 119 <
67 31 <
138 6 [
20 92 [
33 139 [
122 121 <
114 8 [
64 89 ]
96 99 [
56 130 [
73 47 [
43 88 ]
57 44 [
139 48 [
117 115 ]
99 114 [
81 149 <
29 70 {
65 59 <
51 152 ]
125 138 [
28 15 <
90 21 >
31 77 >
84 30 ]
123 42 <
141 40 {
150 116 <
48 135 <
77 145 <
52 5...

output:

2676

result:

ok single line: '2676'

Test #78:

score: 26
Accepted
time: 0ms
memory: 4016kb

input:

200 215 14 73
50 61 }
145 132 ]
14 126 }
84 192 {
42 141 }
136 176 ]
199 77 )
48 128 >
85 178 >
14 188 )
151 80 ]
14 194 {
141 115 )
182 146 >
169 129 }
100 196 }
122 14 [
59 34 >
21 118 }
77 13 (
32 84 )
14 63 )
147 8 }
144 104 )
81 100 ]
183 185 <
126 67 )
139 18 }
96 7 [
37 163 )
123 70 >
55 14 [...

output:

12439474748376

result:

ok single line: '12439474748376'

Test #79:

score: 26
Accepted
time: 52ms
memory: 4544kb

input:

193 2000 56 131
188 193 <
119 115 <
57 71 >
156 58 ]
65 73 [
65 168 ]
45 53 )
81 117 >
110 118 )
98 13 <
174 51 )
191 46 ]
89 146 }
114 154 {
182 192 [
37 27 >
111 118 [
164 100 (
76 21 >
50 101 <
123 47 )
104 160 >
27 173 }
172 172 >
120 111 )
161 92 [
184 185 }
120 66 <
17 70 ]
10 81 [
176 176 <
1...

output:

40

result:

ok single line: '40'

Test #80:

score: 26
Accepted
time: 57ms
memory: 4504kb

input:

200 2000 55 143
131 131 >
196 109 >
187 187 [
168 65 <
114 82 <
195 42 }
154 78 [
57 57 >
119 85 (
80 25 }
25 36 {
31 120 {
179 118 }
175 49 ]
71 28 ]
72 151 (
94 101 [
6 24 <
109 109 }
115 115 <
175 49 <
185 11 ]
5 5 {
47 149 >
120 91 (
162 51 <
78 78 (
148 30 )
34 43 {
96 75 )
114 195 )
142 24 {
5...

output:

74

result:

ok single line: '74'

Test #81:

score: 26
Accepted
time: 3ms
memory: 3944kb

input:

199 312 20 185
5 5 [
181 181 [
135 113 (
15 4 ]
21 110 {
38 101 {
84 14 {
85 182 {
155 54 {
26 55 {
141 70 {
98 183 ]
119 119 [
190 60 {
126 126 [
132 99 ]
164 141 {
57 163 ]
164 164 [
37 2 ]
107 5 {
117 85 {
50 50 [
42 177 {
151 79 {
89 106 ]
92 92 [
192 192 [
3 122 ]
39 136 {
176 176 [
61 61 [
118...

output:

17064

result:

ok single line: '17064'

Test #82:

score: 26
Accepted
time: 4ms
memory: 4168kb

input:

70 500 12 51
65 57 {
40 50 (
70 60 {
46 64 {
48 40 }
45 2 <
28 41 ]
9 1 [
64 12 {
53 18 )
10 38 ]
35 46 ]
70 48 )
53 30 {
30 7 ]
53 61 <
32 61 (
9 8 }
39 39 >
18 45 {
8 19 {
39 24 <
57 66 (
47 30 ]
12 25 )
20 3 )
67 2 }
54 37 >
21 53 {
6 26 ]
38 12 <
66 17 }
67 25 >
6 18 )
62 42 {
29 14 }
38 30 >
53...

output:

-1

result:

ok single line: '-1'

Test #83:

score: 26
Accepted
time: 54ms
memory: 5496kb

input:

200 2000 150 130
113 147 >
29 114 >
171 27 (
1 55 {
40 108 <
129 21 (
63 13 (
198 48 }
195 73 <
198 89 ]
115 32 >
40 142 [
199 5 {
163 178 <
45 34 )
11 77 >
49 14 (
128 76 }
117 88 [
11 103 ]
177 192 )
92 129 )
18 8 (
61 20 [
24 97 [
38 166 <
169 27 ]
126 35 }
78 7 )
196 73 [
107 52 (
1 78 (
194 35 ...

output:

6

result:

ok single line: '6'

Extra Test:

score: 0
Extra Test Passed