QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#366970#5472. Secure the Top SecretFantasy_BallAC ✓5ms7528kbC++143.2kb2024-03-25 15:27:122024-03-25 15:27:13

詳細信息

Test #1:

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

input:

3 3
S..
#..
U.T
7
1 2 b
1 3 b
2 2 b
2 2 r
2 3 b
3 1 r
3 2 r

output:

3

result:

ok single line: '3'

Test #2:

score: 0
Accepted
time: 0ms
memory: 3728kb

input:

2 2
ST
.U
4
1 1 r
1 1 b
1 2 b
2 1 r

output:

-1

result:

ok single line: '-1'

Test #3:

score: 0
Accepted
time: 0ms
memory: 4008kb

input:

7 10
U.........
..........
###.......
..........
.......###
..........
S........T
18
4 4 r
5 4 r
6 7 r
7 7 r
3 4 b
3 5 b
3 6 b
3 7 b
3 8 b
3 9 b
3 10 b
5 1 b
5 2 b
5 3 b
5 4 b
5 5 b
5 6 b
5 7 b

output:

14

result:

ok single line: '14'

Test #4:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

2 5
.T.#S
....U
10
1 3 b
1 1 r
1 1 b
2 1 r
1 2 b
1 5 b
2 2 r
1 2 r
2 3 r
2 4 r

output:

-1

result:

ok single line: '-1'

Test #5:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

5 5
U.S..
.....
.....
.....
.T...
12
2 4 b
4 1 b
2 2 r
1 5 b
2 2 b
4 3 b
5 3 r
1 2 b
3 2 r
2 1 r
3 3 r
2 4 r

output:

-1

result:

ok single line: '-1'

Test #6:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

5 4
....
...U
....
S#..
.#T.
12
3 4 b
2 1 b
4 3 r
2 2 b
4 3 b
3 3 r
2 3 r
1 1 b
2 2 r
4 4 b
3 1 b
1 3 r

output:

-1

result:

ok single line: '-1'

Test #7:

score: 0
Accepted
time: 0ms
memory: 3940kb

input:

3 3
UST
###
.#.
2
1 1 r
1 2 r

output:

-1

result:

ok single line: '-1'

Test #8:

score: 0
Accepted
time: 0ms
memory: 4056kb

input:

4 2
U.
..
.T
S.
8
1 1 b
3 1 r
4 1 r
1 1 r
2 2 b
3 2 b
3 1 b
2 1 r

output:

5

result:

ok single line: '5'

Test #9:

score: 0
Accepted
time: 0ms
memory: 5796kb

input:

2 2
S.
UT
4
1 1 b
1 2 b
2 1 r
1 1 r

output:

-1

result:

ok single line: '-1'

Test #10:

score: 0
Accepted
time: 0ms
memory: 3960kb

input:

3 4
#U.T
#...
.S#.
3
1 2 r
2 2 b
3 1 r

output:

-1

result:

ok single line: '-1'

Test #11:

score: 0
Accepted
time: 0ms
memory: 3804kb

input:

3 5
.U.S.
.#.##
#.T#.
7
1 3 r
1 2 r
1 4 r
1 1 b
1 3 b
2 3 b
3 2 r

output:

-1

result:

ok single line: '-1'

Test #12:

score: 0
Accepted
time: 0ms
memory: 3932kb

input:

4 4
.T.S
#.#.
....
U...
6
3 1 b
1 4 b
2 4 b
3 2 b
4 1 r
3 2 r

output:

-1

result:

ok single line: '-1'

Test #13:

score: 0
Accepted
time: 0ms
memory: 3756kb

input:

5 5
.##T.
##.#.
.#...
##.##
#SU..
6
2 3 b
3 3 r
4 3 b
1 5 b
3 4 r
5 4 r

output:

-1

result:

ok single line: '-1'

Test #14:

score: 0
Accepted
time: 1ms
memory: 4460kb

input:

97 97
S...............................................................................................T
.................................................................................................
.................................................................................................
...

output:

130

result:

ok single line: '130'

Test #15:

score: 0
Accepted
time: 1ms
memory: 4536kb

input:

100 94
S............................................................................................T
..............................................................................................
..............................................................................................
...........

output:

126

result:

ok single line: '126'

Test #16:

score: 0
Accepted
time: 1ms
memory: 4396kb

input:

95 92
S..........................................................................................T
............................................................................................
............................................................................................
..................

output:

124

result:

ok single line: '124'

Test #17:

score: 0
Accepted
time: 0ms
memory: 4416kb

input:

92 92
S..........................................................................................T
............................................................................................
............................................................................................
..................

output:

124

result:

ok single line: '124'

Test #18:

score: 0
Accepted
time: 1ms
memory: 4584kb

input:

96 100
S..................................................................................................T
....................................................................................................
..............................................................................................

output:

134

result:

ok single line: '134'

Test #19:

score: 0
Accepted
time: 1ms
memory: 4536kb

input:

92 90
S........................................................................................T
..........................................................................................
..........................................................................................
........................

output:

120

result:

ok single line: '120'

Test #20:

score: 0
Accepted
time: 0ms
memory: 4512kb

input:

96 90
S........................................................................................T
..........................................................................................
..........................................................................................
........................

output:

120

result:

ok single line: '120'

Test #21:

score: 0
Accepted
time: 1ms
memory: 4528kb

input:

92 94
S............................................................................................T
..............................................................................................
..............................................................................................
............

output:

126

result:

ok single line: '126'

Test #22:

score: 0
Accepted
time: 1ms
memory: 4612kb

input:

99 94
S............................................................................................T
..............................................................................................
..............................................................................................
............

output:

126

result:

ok single line: '126'

Test #23:

score: 0
Accepted
time: 1ms
memory: 6448kb

input:

93 91
S.........................................................................................T
...........................................................................................
...........................................................................................
.....................

output:

122

result:

ok single line: '122'

Test #24:

score: 0
Accepted
time: 2ms
memory: 4556kb

input:

50 83
........................#.............................#........#......#.....#......
...........................................#........#................#........#....
....................#.....#........................................................
................................#............

output:

22

result:

ok single line: '22'

Test #25:

score: 0
Accepted
time: 1ms
memory: 4400kb

input:

58 98
.........#.....#...U............#..............#.......#....................##...........#........
.........#........#.....#...#..#........#.#.........#..................#.#........................
.#.##.......#........#......#..#.....#.........#..#.........#...##.........###..##......#..........

output:

-1

result:

ok single line: '-1'

Test #26:

score: 0
Accepted
time: 2ms
memory: 4676kb

input:

80 48
..##.#.........#...#.....#............#.#.#.#...
....#........#.......#...#.##.#.##....#.##.#...#
#......##.#..#.......#.....##..#..#.......##.#.#
.##.#...#.#.#.#.....###...#......#............##
.....#.#.....#.#..##.......##..#...#.#..#..##...
.......#....#.#...##.##.##....#...#......#..####
...

output:

2

result:

ok single line: '2'

Test #27:

score: 0
Accepted
time: 1ms
memory: 6144kb

input:

40 49
#.....................#..................#.......
..................#......#....#..#....#.#.......U
......#.................................#........
.................................................
#.......#.......#..........#.....................
....#.......#.......#............#.............

output:

9

result:

ok single line: '9'

Test #28:

score: 0
Accepted
time: 0ms
memory: 3928kb

input:

25 39
.......................#...............
...................................#...
.......................................
##.......................#.............
..................#.........#..........
..#...................................U
...............................#.......
.................

output:

-1

result:

ok single line: '-1'

Test #29:

score: 0
Accepted
time: 0ms
memory: 3972kb

input:

17 47
..#.....#...#...#........................T.#...
.........................#.........#......#....
.....#..........##..#.......#...#........#.....
......#.......................#................
##...#........#.......##.#.#.......#.##........
...............................................
#..#.....

output:

-1

result:

ok single line: '-1'

Test #30:

score: 0
Accepted
time: 1ms
memory: 5972kb

input:

18 66
...#..#...#..#.#...#U#.#....##...#.#.#.......#.#..........#......#
....##...#...##..##.....#..#.##.#..##...........#....#.....#...#.#
#...##..........##.....#........#...##.#.##............#.#...#.#..
#.#..#..#........#..#....#...#..#.....##..#..#..............#....#
.........#...##.#..#.#.###...

output:

4

result:

ok single line: '4'

Test #31:

score: 0
Accepted
time: 2ms
memory: 4736kb

input:

69 81
.....#..........#.##..U....#..#.S#....#..###..##...........#....##..####.#T.##.##
##........##...##.#.#.##...#.###.#...#....##..#...#..###.....#.................#.
.......##...###..#....#..###.....#..##...#....#..#..#...#.#...#.#....#...##...#.#
#...#...........##..###.#.#.##.#...#.#....#..#.#...

output:

2

result:

ok single line: '2'

Test #32:

score: 0
Accepted
time: 2ms
memory: 6444kb

input:

87 26
.##....#.U.#.#.#......#...
...#...##..#...#.##...#..T
#..........#...#.....#.#..
##.#..##...##.#..#..#.....
................##.....##.
......###..##.#..#..#.....
...#.....#....##..#.......
#.......###..#.....#......
######..##......#.....#...
#.#.#....#.#.........#..#.
.#.....#..###..#......#....

output:

4

result:

ok single line: '4'

Test #33:

score: 0
Accepted
time: 1ms
memory: 4268kb

input:

19 92
.#....#.#.....#.#.........###..S##.#...#..#.#..#...#..####.......#.......#...#.##.##...##...
.......#.#.#.#..#...#..###..#...#..#....#......##........#.#.........#..#.###....#.....#....
......#...#..#.#...#.....##..##......##.###....#...#....#.#.###..#...#####.##..#....#..#.###
.##...##.#.#..#...

output:

2

result:

ok single line: '2'

Test #34:

score: 0
Accepted
time: 1ms
memory: 4728kb

input:

92 96
...#..##.#..##.......#.....#..#.#S#....#.........##...#.#..#...#.......#..#............#..#..#..
...#.#.#.#....#.##....#....#.#....#...#...#....#..##....#..#....#...#..#....#....##....#..#.....
.#...#..#.........#..........#.##.#..#..#.#..#..#.....#.#....#.#.#..........##.......#.#....##..
......

output:

-1

result:

ok single line: '-1'

Test #35:

score: 0
Accepted
time: 4ms
memory: 6584kb

input:

90 90
##....#........#..#..#.#...#...#.#....#.#....##..#.#......#...#......T.#..####........#.#.
..#...............#.#...#...#......#.......#.#..#.#.......#...#.....##....#..##.....#.....
.###.......##.##.........#.#.#..##.##..#........#.#......#......#.#.#..###..##..#.#.....#.
..##......#.........#...

output:

6

result:

ok single line: '6'

Test #36:

score: 0
Accepted
time: 1ms
memory: 4704kb

input:

98 93
..#...........##..........##.#......#....#.....#.......#..#.#.#.......#..................U.#.
..#........#..#..#...#...##.................#.#........#.......##.#..#..#.....#.......#.###.#
...........###..#####.#..##.......#.#........#.#.....#.......#......#....#..#..#.............
#...#.#........

output:

-1

result:

ok single line: '-1'

Test #37:

score: 0
Accepted
time: 0ms
memory: 4896kb

input:

96 97
#............#.................#....#.#.#...#....#..###..#.#....#.##...#..#...........#..........
..#.........##........#...#.##....##....###...#.###..#.#..............##.#.....................#.
..#..........#.#.#..#...........#...##............#......##...................#......##....#.....
...

output:

-1

result:

ok single line: '-1'

Test #38:

score: 0
Accepted
time: 0ms
memory: 6376kb

input:

91 94
#...........#.#.##.#..#.....#.#........S.##.......##....#..#........#..#...#..#..#........#U#.
...#.....#..#.....##.#..#.##....#...#.##....#....#......##.#.#............##.......#....#....#
#..#...#..#...#.#..###.#...#....#..##....#....##....#.#.##.........#..#...#.#........#.#.#..##
....##......

output:

4

result:

ok single line: '4'

Test #39:

score: 0
Accepted
time: 0ms
memory: 6968kb

input:

94 91
...........#......#...#.....#..###.....#.......#....##.#....#........#......####.......#...
..#...###...##.......#..#....#..#.###.#....#......#.#..####.##...#...#..##..#.#...###..#...
..#.#.##..#...........#.........#.#.......#...........#.###......#..#....#......#...#......
.#.....##..#.....#...

output:

21

result:

ok single line: '21'

Test #40:

score: 0
Accepted
time: 3ms
memory: 5076kb

input:

90 94
##..........#.#.#.....#.....#..#..#......#.#..##..##....##..#.#.#..#.###.#...#.........T.#....
....#.#.....#.#...............##..#..##.##.#..#....##....###.#.#.#...#..###.........#.##....##
...##.............#..#.....#..#..#.......#....#...###....#.#..#...#.#....#...###..####........
#..##...#...

output:

24

result:

ok single line: '24'

Test #41:

score: 0
Accepted
time: 0ms
memory: 4640kb

input:

93 98
.............#.........#.....U..#......................##.........................................
...........#............#...........................................................###...#.......
....................................................................................#..............

output:

-1

result:

ok single line: '-1'

Test #42:

score: 0
Accepted
time: 3ms
memory: 5188kb

input:

96 100
..........#........#..#...#..#.........#....#....#.#.....##......##....##............#.............#
.......#.#..#.#.#..#....................#..............##.....#.........#...#...#.....#.....#.....#.
##.....##.#.###...#...#.#.............###.#.......#.#................#........#........##.....

output:

12

result:

ok single line: '12'

Test #43:

score: 0
Accepted
time: 4ms
memory: 5168kb

input:

100 99
................#..#............T.....#.....#.....#............#.#.....U.#..#.....#..........#.....
.................................#.#...............................................................
............#..........#..#..#.........#...................#............................#.......

output:

100

result:

ok single line: '100'

Test #44:

score: 0
Accepted
time: 0ms
memory: 4096kb

input:

13 22
..#...#U#......#....##
......##.............#
......#....#...#.....#
.........#..#.........
...................#..
......###.........#..#
....#..............#.T
.#..#...#.............
#.....#.....##...#....
.#.........#.##.......
......#..#............
.#.....#...#...#......
..S..#.#.............

output:

0

result:

ok single line: '0'

Test #45:

score: 0
Accepted
time: 1ms
memory: 6200kb

input:

84 35
...#.#.#.......###..#......##.###..
...#....##.#..##......###.#..#.##..
...###.....#..###.#..#.#..#...#...#
#...###.#..#..#....#...#.#.#.....#.
###...##......#.##.#.....#...#.#..#
...#.#...###......#.....#....#....#
#.#..##.##.###...#..###....##.##...
###..#.#........#...#.#.##.#.#.....
...#.....

output:

0

result:

ok single line: '0'

Test #46:

score: 0
Accepted
time: 0ms
memory: 4040kb

input:

3 82
#..#.#.....#........#.##........####...#...#..##...#......#..S.##..#..#..#..##..#.
...#..##.............#...#..#....#...............#.#....##....#...................
.#..............U................#...#...##.......#..#...T.#..#......#...#......#.
250
2 73 b
2 19 r
3 11 r
2 13 r
2 35 b
3 64 r
...

output:

0

result:

ok single line: '0'

Test #47:

score: 0
Accepted
time: 0ms
memory: 6204kb

input:

85 67
...##....##..#..#....##..##S.##...#....#.#............#............
.......#.#..#....#..#..#.#...##..##.#...#.#.#...#......#.....##..#.
..#.....#.....#.#.......#.....#.......#..#.###..#.........#........
##.#.#.#.#.###.#..........##....#.....#.#..##.#...........#...###.#
...........#.......#.....

output:

0

result:

ok single line: '0'

Test #48:

score: 0
Accepted
time: 1ms
memory: 4188kb

input:

42 30
##.....##.#.#T.#.#.#.#....#.#.
..#.......##...#.#.#...#......
#.........#...#.##....#..#....
.....#..#....#..#...##...####.
#.......###...#..#......#..#..
...#.....#......#..#......#.##
##.#.#.#..#...#.......####....
....#...##.....#....#.#.#.....
........#..#.#......#....#.#..
.#.##.#...###.....

output:

0

result:

ok single line: '0'

Test #49:

score: 0
Accepted
time: 2ms
memory: 4568kb

input:

62 62
..........##...#.#.............#.#..........#.................
...............#.#............#..........................#....
...................#.........................##...............
........#............#..................#................#....
..........................#..#.......##......

output:

8

result:

ok single line: '8'

Test #50:

score: 0
Accepted
time: 3ms
memory: 5148kb

input:

89 74
...#....#.#....#...........#..#T.#....................##.U.............##.
...##.....#......##......................#....#.#..#....#..#........##....
...#.##............#...#.........#........#.#..........##.#..#............
.#.......#.....#.....#..#..............##.#................#............

output:

4

result:

ok single line: '4'

Test #51:

score: 0
Accepted
time: 2ms
memory: 6592kb

input:

100 37
.....................#..#.........#..
.............#........#........#.....
...........#.........................
..##..#.....#.............#..........
............#..................#.....
#..#................##...#...........
..#...........#...#..................
..................#.#.....#...

output:

6

result:

ok single line: '6'

Test #52:

score: 0
Accepted
time: 2ms
memory: 6220kb

input:

44 89
...#.#.#...##.#.#.....#..##..#.#......##.........#..##....#.....##....##.#.........#..#..
##....##.#...........#...#..##.#....#...#.#.#......#........#..#..........#.......##....#
....#..#...#.#......#.#...###.#......#....#.#.#......#...##..............##.#.##...#..#..
.#.....###.#..#...#..#.....

output:

4

result:

ok single line: '4'

Test #53:

score: 0
Accepted
time: 1ms
memory: 4072kb

input:

68 17
##.....#....#....
.#.##...#...#...#
...#....#....##..
..#...#........#.
..#..####.#...##.
.....###.........
.#.........#..#.#
....#.#.#.#.....#
...#.....#.......
#..#.###...####..
..##.##....#.#...
##.....#.#.....#.
....#....#......#
..##.............
.....#.........#.
....#...........#
..##.....

output:

6

result:

ok single line: '6'

Test #54:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

16 23
..#..##.#U.#...#....#.#
...#...##.##.#...##...#
...#.#..#..##.#..#.#...
...#..#.#.#..#....#...#
##..#..#........#......
.......#.#.#........#..
.#.....#...#..#.#......
........#..###.....###.
.##.......#.###..##.#..
.....#..######......#..
#..#....#....#.#....#.#
....#.#..#....##....##.
.#.#.....

output:

-1

result:

ok single line: '-1'

Test #55:

score: 0
Accepted
time: 0ms
memory: 4012kb

input:

43 67
.............#....#.............................S.#............#...
..........#.................#.............#........................
................................#................................#.
.........................#..........#...........#..................
....#....................

output:

-1

result:

ok single line: '-1'

Test #56:

score: 0
Accepted
time: 0ms
memory: 4100kb

input:

79 22
.#......#..#...#.#...#
............#.........
.###.......#.#..#....#
..#..#...........##...
......#.....###....#.#
#.......#..#........#.
.....#.....#..........
......#.#.#.......#...
....#......##..#....#.
...#...#......##......
.....#...#.#..###.....
.....###.......#......
#...........#..#.....

output:

-1

result:

ok single line: '-1'

Test #57:

score: 0
Accepted
time: 0ms
memory: 3888kb

input:

9 18
...#...#....#....#
.........##.......
..#.....#.#..###.U
...#..#..####...#T
.#.###.##.......#.
......#....####.#.
#....#....##.#..##
S............#.#..
###..#....#...#..#
0

output:

-1

result:

ok single line: '-1'

Test #58:

score: 0
Accepted
time: 1ms
memory: 4164kb

input:

40 72
#...#...#......#.#.#....#.##..##.#..##.#####..#.##...###.#.####..##.....
.###.#..#.......#..#..#..#.#.#....##.....#..###.#..#.##..#.#.#....#....#
..#.#..#..#..#....#..####....#.#....##............#..#...##..#.#.#..#..#
####..#.##.....#..#........#.#......#...#..###.......##..#..............
.....

output:

-1

result:

ok single line: '-1'

Test #59:

score: 0
Accepted
time: 4ms
memory: 6672kb

input:

100 100
....................................................................................................
.........#..........................................................................................
.........................................................................................#...

output:

-1

result:

ok single line: '-1'

Test #60:

score: 0
Accepted
time: 1ms
memory: 4628kb

input:

100 100
...........#..........................##...#....#.#..............##.....#.#..........#.......#...#..
.....#.....#...#...........#....##............#.....##................#..##.......###...#...........
..#......##.....#.#.#.....#...#.#.....#..#........................#.#.#........#.#..###..#...

output:

-1

result:

ok single line: '-1'

Test #61:

score: 0
Accepted
time: 0ms
memory: 4856kb

input:

100 100
................##.....#........................................#...##.......#...#..S...##.......U..
...#.....#..................................#.............###......................#................
.........#....#......#.....................................#......#.............#............

output:

-1

result:

ok single line: '-1'

Test #62:

score: 0
Accepted
time: 4ms
memory: 5052kb

input:

100 100
..........................#........#..............#.........##.#.#....#....#...#....................
.......................#.................#..##..................#.....................#..#.#........
...........#....................#....................#....#...................#..............

output:

17

result:

ok single line: '17'

Test #63:

score: 0
Accepted
time: 4ms
memory: 5180kb

input:

100 100
.......................................U............................................................
............................................................................##......................
.............................................................#...............................

output:

42

result:

ok single line: '42'

Test #64:

score: 0
Accepted
time: 4ms
memory: 6428kb

input:

100 100
....................................................................................................
....................................................................................................
.............................................................................................

output:

10

result:

ok single line: '10'

Test #65:

score: 0
Accepted
time: 5ms
memory: 7100kb

input:

100 100
#........................................#.......................#..................................
..............................................#......#..................#......................#....
....#...........#................#......#....................................................

output:

10

result:

ok single line: '10'

Test #66:

score: 0
Accepted
time: 5ms
memory: 7528kb

input:

100 100
...##.##......##.........#....###...#.#..#.#..##..###..#..#.#..#...#.#.........#.#.#....#.#..#.#...T
...#.#..##.#..#.#.................#..............#.#.....#........##....#....#..........#..#.#......
#.#.....#...#...#..##...................#.#..#..##.#......#..#........#.#....#...#...#.......

output:

3

result:

ok single line: '3'

Test #67:

score: 0
Accepted
time: 5ms
memory: 5636kb

input:

100 100
.............................#.......................#..............................................
...............................................................................#....................
......#...###.......................................................##............#..........

output:

6

result:

ok single line: '6'

Test #68:

score: 0
Accepted
time: 5ms
memory: 6412kb

input:

100 100
.......#......................#.....#.............#.....T.......#.............#.....................
.....................................#..............................#...................#.......##..
................................#....#........................#..............................

output:

7

result:

ok single line: '7'

Test #69:

score: 0
Accepted
time: 3ms
memory: 5224kb

input:

100 100
S..................................................................................................T
....................................................................................................
.............................................................................................

output:

9902

result:

ok single line: '9902'

Test #70:

score: 0
Accepted
time: 0ms
memory: 7064kb

input:

100 100
S..................................................................................................T
....................................................................................................
.............................................................................................

output:

9506

result:

ok single line: '9506'

Test #71:

score: 0
Accepted
time: 3ms
memory: 6740kb

input:

100 100
S..................................................................................................T
....................................................................................................
.............................................................................................

output:

2280

result:

ok single line: '2280'

Test #72:

score: 0
Accepted
time: 3ms
memory: 5296kb

input:

100 100
S..................................................................................................T
....................................................................................................
.............................................................................................

output:

1470

result:

ok single line: '1470'

Test #73:

score: 0
Accepted
time: 0ms
memory: 7196kb

input:

100 100
S..................................................................................................T
....................................................................................................
.............................................................................................

output:

102

result:

ok single line: '102'

Test #74:

score: 0
Accepted
time: 0ms
memory: 3956kb

input:

2 3
STU
###
2
1 1 r
1 2 r

output:

-1

result:

ok single line: '-1'

Test #75:

score: 0
Accepted
time: 0ms
memory: 4068kb

input:

2 4
ST.U
####
3
1 1 r
1 2 r
1 3 r

output:

2

result:

ok single line: '2'

Test #76:

score: 0
Accepted
time: 0ms
memory: 3876kb

input:

3 5
S.U##
##.##
..T..
4
1 1 r
1 2 r
1 3 b
2 3 b

output:

-1

result:

ok single line: '-1'

Test #77:

score: 0
Accepted
time: 0ms
memory: 3920kb

input:

10 10
......S...
..........
##........
.....#....
.....#..##
.........T
U.........
..........
....#.....
....#.....
30
6 9 r
3 7 r
4 8 b
5 8 b
2 6 b
3 3 b
7 5 b
4 1 b
4 3 b
6 7 b
7 6 r
6 9 b
3 7 b
6 6 r
4 4 r
4 5 b
8 5 r
4 7 b
3 4 r
5 7 b
6 8 b
7 6 b
4 4 b
4 2 b
2 5 b
6 5 r
2 7 b
3 4 b
7 5 r
8 4 r

output:

21

result:

ok single line: '21'

Test #78:

score: 0
Accepted
time: 0ms
memory: 5864kb

input:

10 10
..........
..........
..........
..........
..........
.....#....
##....#...
U...#..#..
####......
ST........
25
8 9 b
7 9 r
9 8 r
6 4 r
10 1 r
3 5 b
6 9 b
9 6 b
7 9 b
4 4 r
9 8 b
4 6 r
9 5 r
8 10 b
6 4 b
5 4 r
9 10 b
7 3 r
5 6 r
6 8 b
7 4 b
8 9 r
9 9 r
3 6 b
9 7 b

output:

21

result:

ok single line: '21'