QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#755755#9560. Judgementucup-team159#AC ✓54ms41972kbC++206.9kb2024-11-16 17:59:252024-11-16 17:59:26

詳細信息

Test #1:

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

input:

4
3 3
1 1 1 2
RBB
RRR
BBR
6 6
1 1 6 6
RRRRRR
BBBBBR
BRRRBR
BRBBBR
BRRRRR
BBBBBB
5 5
3 3 4 4
BBR.B
BBR.B
RRR.B
...BB
BBBB.
1 5
1 1 1 3
RBBBR

output:

YES
YES
NO
NO

result:

ok 4 token(s): yes count is 2, no count is 2

Test #2:

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

input:

18
4 4
3 3 2 2
....
.BB.
.BR.
....
7 8
5 6 3 3
..RRRRRR
..R....R
BBBBBB.R
B.B..R.R
B.RRRRRR
B....B..
BBBBBB..
5 2
3 1 3 2
B.
BR
RB
BR
.R
3 3
2 2 1 2
.BB
BRB
BBB
3 3
1 2 3 2
RRR
...
BBB
3 3
1 1 1 3
RRB
...
BRR
3 3
1 1 3 1
RRB
...
BRR
3 3
3 1 1 1
BBR
..R
RBB
3 3
2 2 2 1
.BB
BRB
.RB
1 2
1 1 1 2
RB
2 2
...

output:

YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES

result:

ok 18 token(s): yes count is 12, no count is 6

Test #3:

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

input:

10000
3 2
3 1 3 2
..
..
RB
3 2
3 2 3 1
..
..
BR
3 2
2 2 3 2
..
.R
.B
3 2
2 2 3 2
..
.R
RB
3 2
3 1 3 2
..
.R
RB
3 2
2 2 3 1
..
.R
B.
3 2
2 2 3 1
..
.R
BR
3 2
3 2 3 1
..
.R
BR
3 2
2 2 3 1
..
.R
BB
3 2
2 2 3 2
..
.R
BB
3 2
3 2 2 2
..
.B
.R
3 2
3 1 2 2
..
.B
R.
3 2
3 1 2 2
..
.B
RR
3 2
3 2 2 2
..
.B
RR
...

output:

YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
...

result:

ok 10000 token(s): yes count is 5813, no count is 4187

Test #4:

score: 0
Accepted
time: 19ms
memory: 3936kb

input:

10000
2 3
2 2 2 3
...
.RB
2 3
2 3 2 2
...
.BR
2 3
2 1 2 3
...
R.B
2 3
2 1 2 3
...
RRB
2 3
2 2 2 3
...
RRB
2 3
2 1 2 2
...
RB.
2 3
2 1 2 2
...
RBR
2 3
2 3 2 2
...
RBR
2 3
2 1 2 2
...
RBB
2 3
2 1 2 3
...
RBB
2 3
2 3 2 1
...
B.R
2 3
2 2 2 1
...
BR.
2 3
2 2 2 1
...
BRR
2 3
2 3 2 1
...
BRR
2 3
2 2 2 1
.....

output:

YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 5811, no count is 4189

Test #5:

score: 0
Accepted
time: 12ms
memory: 3976kb

input:

10000
2 2
2 1 2 2
..
RB
2 2
2 2 2 1
..
BR
2 2
1 2 2 2
.R
.B
2 2
1 2 2 2
.R
RB
2 2
2 1 2 2
.R
RB
2 2
1 2 2 1
.R
B.
2 2
1 2 2 1
.R
BR
2 2
2 2 2 1
.R
BR
2 2
1 2 2 1
.R
BB
2 2
1 2 2 2
.R
BB
2 2
2 2 1 2
.B
.R
2 2
2 1 1 2
.B
R.
2 2
2 1 1 2
.B
RR
2 2
2 2 1 2
.B
RR
2 2
2 1 1 2
.B
RB
2 2
2 1 2 2
.B
RB
2 2
2 ...

output:

YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
YES
...

result:

ok 10000 token(s): yes count is 7778, no count is 2222

Test #6:

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

input:

10000
3 3
3 2 3 3
...
...
.RB
3 3
3 3 3 2
...
...
.BR
3 3
3 1 3 3
...
...
R.B
3 3
3 1 3 3
...
...
RRB
3 3
3 2 3 3
...
...
RRB
3 3
3 1 3 2
...
...
RB.
3 3
3 1 3 2
...
...
RBR
3 3
3 3 3 2
...
...
RBR
3 3
3 1 3 2
...
...
RBB
3 3
3 1 3 3
...
...
RBB
3 3
3 3 3 1
...
...
B.R
3 3
3 2 3 1
...
...
BR.
3 3
3 ...

output:

YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 4085, no count is 5915

Test #7:

score: 0
Accepted
time: 36ms
memory: 3676kb

input:

10000
5 5
5 5 4 4
R.RR.
BRBRB
RBBBR
.RBBR
B.RBR
5 5
2 3 4 5
BRRRB
RBRRR
RRBRB
.BBBB
..B.R
5 5
2 1 5 4
.BRBB
RBRR.
..RRR
R.RR.
BBRB.
5 5
5 1 4 4
BBR.R
BRRRR
RRRRR
RRRB.
RB.B.
5 5
1 1 5 4
RBRBR
BB.BB
BB.RB
R.BRR
.B.BB
5 5
1 4 3 5
RBRRR
.RBB.
..BBB
.B.RB
RBRBR
5 5
2 4 1 3
..BBR
BBBRR
RBR.B
BB.RB
RB..B
...

output:

NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
YES
NO...

result:

ok 10000 token(s): yes count is 5589, no count is 4411

Test #8:

score: 0
Accepted
time: 35ms
memory: 3936kb

input:

10000
5 5
1 1 4 5
RBRBR
BBBBB
BBBBR
BRBBB
RRBBB
5 5
1 2 4 1
BRBBB
BRBRB
RRRBB
BBBBR
RRRRB
5 5
5 3 3 2
BBBRB
RBRBB
BBRRB
BBRRB
RRRBB
5 5
1 2 1 4
BRBBB
BBRBB
RBRRB
RRBRR
RRRBR
5 5
2 4 3 3
RBRRB
BRRRB
BRBRR
RBBBB
RBBBR
5 5
4 5 1 1
BRBRR
BRBBR
BBRRR
BBRRR
RBRBR
5 5
2 4 5 3
RBRRR
RBBRB
BRBBB
BRRRR
BRBRB
...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 10000, no count is 0

Test #9:

score: 0
Accepted
time: 15ms
memory: 4820kb

input:

25
100 100
43 66 65 57
RRBBR.BRRBRBBRRBBBRR.BRRRBRBBBRB.RBBRBRB.RBBBRRRBR.BRBRBR.BBBBBBBBRRRBRBRRBRR.BBRBBBRRBBRBBBBRBBBBBR
BBRRBBBRRB.RRBBBRB..RRRBRBBRRBBRBBBRRRRRRRR.R...RBRBBRB..BRBB.RRBRRRRRBBBB.R.RRR.BR...RRBRRRR.RBRR.R
.BBBRRR..BBBRRRBRRBRRBRBRRRBBRRBR.BRRBRRB.BBRBRRBBRRRRBRRBBRRBB.RBBR.RRRRBB...

output:

NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO

result:

ok 25 token(s): yes count is 6, no count is 19

Test #10:

score: 0
Accepted
time: 30ms
memory: 39884kb

input:

1
500 500
249 446 156 245
RBBBRBRBBBBBRRRBBRRRBBBRRBBBRRRB.BRBRRRRBBR.BRBBRRRBBBBRRBRBBRBBRBBBBRRRBBBBRBRRRBRRBBBBRBBRRRBRBRRBBRBBBRBBBRBRBBRBRRRRRBRRBRBBBRRBBBRRBBBRBBRBBRBBBRRBRBB.RRBRRBRRBRRBRRRRRRRRBBBRRBRRRBBBRR.RRRBRBR.RRBBRRBRRRBRRRBRRBBRBBRRRRRRBBRRBBRBRRBBRRBBRRRBRRRRRBRBBRRRRBBBRRBBBRBRBBB...

output:

YES

result:

ok YES

Test #11:

score: 0
Accepted
time: 36ms
memory: 41004kb

input:

1
500 500
385 22 468 219
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRB.BRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBBBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBR...

output:

YES

result:

ok YES

Test #12:

score: 0
Accepted
time: 31ms
memory: 41932kb

input:

1
500 500
81 411 210 169
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBR...

output:

NO

result:

ok NO

Test #13:

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

input:

1000
10 25
1 22 1 5
...BBBBBBBBBBBB......R...
.....B.BB............R...
.BBBBBBBBBB..............
...B.BBBB..B.............
.BBBBBBBBBBBBBB..........
...B.BBBBBBBB............
.BBBBBBBBBBB.............
...B.BB..B.B.............
.....BB..B.B.............
.....B...................
10 25
3 20 9 11
.......

output:

YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
Y...

result:

ok 1000 token(s): yes count is 993, no count is 7

Test #14:

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

input:

20
30 50
10 39 6 49
...............................R....RR...R..RR....
...............................R...RRRR..R..RRRRRR
..............................RRBRBRRRRRRRRRRRRR.R
.................................RRRRRRRRRR.RRRRRR
................................RRRRRRRRRRRRRRRRRR
............................

output:

YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO

result:

ok 20 token(s): yes count is 14, no count is 6

Test #15:

score: 0
Accepted
time: 28ms
memory: 36552kb

input:

1
500 500
39 437 235 437
................................................................................................................B..........B..........................B......................B..B...B.......B......B............B......................BB.BBB..BB....R...B....B.B..RB.B.BB.R..B.B.B...

output:

YES

result:

ok YES

Test #16:

score: 0
Accepted
time: 54ms
memory: 3708kb

input:

10000
5 5
2 5 3 5
.RRRR
.RRRR
RRRRB
.RRRR
RRRR.
5 5
3 4 4 1
RRRRR
RRR..
RR.RR
BRRRR
RRRRR
5 5
1 4 4 2
RRRRR
.RRRR
RR.RR
RBRR.
RRRRR
5 5
1 2 2 4
RR.RR
R.RBR
RRRRR
RRRRR
R.RRR
5 5
4 4 1 2
RBRRR
RRRRR
RRRR.
RRRRR
RR.RR
5 5
3 2 2 2
RR.R.
RBRR.
RRRRR
RRRRR
RRRRR
5 5
4 2 3 3
RRRRR
RRRRR
RRBRR
RRRR.
RRRRR
...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
Y...

result:

ok 10000 token(s): yes count is 9084, no count is 916

Test #17:

score: 0
Accepted
time: 37ms
memory: 3708kb

input:

2500
10 10
4 9 9 5
.BBBBBBBB.
BBBBB.BBBB
BBBRBBBBBB
B.BBBBBBRB
BBBBBBBB.B
BBBBBRBBBB
BBBBBB.BBB
BBBB.BBBBB
BBBBBBBB..
.BBBBBBBB.
10 10
9 9 1 9
BBBBBBBBBB
BBB.BBBBBB
BB..B..B.B
.BBBBBBBBB
..BBBBBBB.
BBBBBBBBBB
BBBBBBBBB.
BBB...BBBB
B.BBBBBBRB
BBB.BBBBBB
10 10
8 10 2 10
.BBBBBBBBB
BBBBBBBB.B
BBBBBBBBB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES...

result:

ok 2500 token(s): yes count is 2307, no count is 193

Test #18:

score: 0
Accepted
time: 25ms
memory: 3732kb

input:

1000
10 25
7 14 7 1
B.R.BBRRRRRRRRRRRRRRRRRRR
BRR.BBRRRRRRRRRRRRRRRRRR.
BBBBBBBBBRRRRRRRRRRRRRRR.
BBBBBBRRRRRRRRRRRRRRR.RR.
BBRBBBRRRRRRRRRRRRRRRRRRR
BBRBBBRRRRRRRRRRRR.RRRRRR
BBRBRBRRRRRRRRRRRRRRRRRR.
BBBRRRRRRRRRRRRRRRRRRRRRR
BBRBRRRRRRRRRRRRRRRRRRRRR
BBBRRRRRRRRRRRRRRRR..RRRR
10 25
8 19 1 10
...B...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 1000 token(s): yes count is 999, no count is 1

Test #19:

score: 0
Accepted
time: 29ms
memory: 3716kb

input:

1000
10 25
2 25 3 3
BBBBBBBRRRRRRRRRRRRRRRRRR
BBBBBBBRBBRRRRRRRRRRRRRRR
BBBBBBBRBBBRRRRRRRRRRRRRR
BBBBBRBBBBBBRRRRRRRRRRRRR
BBBBBBBBBBBBBRRRRRRRRRRRR
RRBBRBBBBBBBBRRRRRRRRRRRR
RRRRRRBBBBBRBRRRRRRRRRRRR
RRRRRRRBBBBRBRRRRRRRRRRRR
RRRRRRRRBBBBBRRRRRRRRRRRR
RRRRRRRRBBBBBBBRRRRRRRRRR
10 25
4 24 1 16
RRRB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 1000 token(s): yes count is 1000, no count is 0

Test #20:

score: 0
Accepted
time: 18ms
memory: 3652kb

input:

1000
10 25
3 15 2 6
....B..RRRRRRRRRR........
...BBB.RRRRRRRRRRBB......
..BBBB.RRBRRRRRRRRRR.....
.BBBBBBBBRRRRRRRR........
BBBBRBBR.RRRRRRR.........
.BBBBBBBBRRR.RRRRR.......
.BBRBBBBBRRRRR.RR........
BBBBBBBBBRR..............
BBBBBBBBBRRR.............
BBBBB....RRB.............
10 25
5 22 10 24
......

output:

YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
Y...

result:

ok 1000 token(s): yes count is 720, no count is 280

Test #21:

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

input:

20
30 50
29 37 6 22
................B..BBBBBBB..B..B......R...........
..............BBBBBBBBBBBBBBBB.B......R...........
...............BB.BB.BBBBBB.BB.BBBBBBBR...........
..........BBBBBBBBB..BBBBBBBBB.B......R...........
...............B..B.BBBBBBBBBBBBB.....R...........
................BBBBBBBBB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 20 token(s): yes count is 20, no count is 0

Test #22:

score: 0
Accepted
time: 32ms
memory: 4020kb

input:

1000
10 25
9 12 7 2
.BBRBRBR.R.RBRBBRRBRBRBBB
RRRBRBR.RBRBRBRBRBRBRBRRR
BRBRBRBRBRB..RBR.RBRBRRRB
RRRBRBRBRBRBRBRB.BRB.RRRR
RRB.RRB.BR.RBRB.B..BBRRRB
RBRBRBBBRBBBBBRRR.RBRBRRR
BBB.BRBRBRBRBRB.BRRRRRBRB
RBRBRRR.RBRBR.RR.BRBRBRBR
B.BRBRBRBRBRBRBRBRBRBRBRB
RBRBRBRRRBRBRBRBRBBBRBB.R
10 25
3 2 6 4
BRBRBR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
YES
NO
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 866, no count is 134

Test #23:

score: 0
Accepted
time: 22ms
memory: 3732kb

input:

1000
10 25
8 3 9 4
BBBRBRBR..B.BRRRBRRR.RBBR
R.RBRBRBRB..RBRB.BRBR.RB.
BRB.BRBR.RBBB.BRRRBB.RBRB
.B.BRBRBRRRBRB.RRBRBRBRB.
B.BRBRBBB.BRRRBRBB..B.BRB
RBBBRRBBRBRRBBRRBBRRRR.BR
.RBRBRBRBR..BRR.BR.RBRBRB
RBR.RRRBR.RBRBBRRBRB.BR.R
RR.BRR.BRRBRBRB..RRRBBRR.
R.BB.BR.RB.BRBB.RBRBRBRB.
10 25
4 9 9 12
RBR.BB...

output:

NO
YES
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES...

result:

ok 1000 token(s): yes count is 340, no count is 660

Test #24:

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

input:

1000
10 25
5 11 8 10
BRBRBRBRBRBRBRBRBRBRBRB.B
RBRBRBRBRBRBRBRBRBRBRBRBR
BRBRBRBRBRBRBRBRBRBRBRBRR
RBRBRBRB.BRBRBRBRBRBRBRBR
BRBRBRBRBRRRBRBRBRBRBRBRB
RBRBRBRBRBRBRBRBRBRBRBRBR
BRBRBRBRBRBRBRBRBRBRBRBRB
RBRBRBRBRBRBRBRBRBRBRBRBR
BRBRBRBRBRBRBRBRBRBRBRBRB
RBRBRBRBRB.BRBRBRBRBRBRBR
10 25
8 14 5 14
RBR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES...

result:

ok 1000 token(s): yes count is 974, no count is 26

Test #25:

score: 0
Accepted
time: 40ms
memory: 41928kb

input:

1
500 500
354 375 152 425
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRB...

output:

YES

result:

ok YES

Test #26:

score: 0
Accepted
time: 41ms
memory: 41972kb

input:

1
500 500
156 432 199 336
RBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRBRB...

output:

NO

result:

ok NO

Test #27:

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

input:

1250
1 20
1 11 1 20
..RRRRRRRRRRRRRRBBBB
1 20
1 2 1 14
RRRR......BBBBBBBBBB
1 20
1 2 1 17
RRRRRRRRRRRRBBBBB...
1 20
1 11 1 6
BBBBBBRRRRRRRRRRRRRR
1 20
1 20 1 8
BBBBBBBB..RRRRRRRRRR
1 20
1 10 1 17
RRRRRRRRRRBBBBBBB...
1 20
1 5 1 17
RRRRRRRBBBBBBBBBBBBB
1 20
1 11 1 14
RRRRRRRRRRR.BBBBBBBB
1 20
1 18 1 ...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 1250 token(s): yes count is 1250, no count is 0

Test #28:

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

input:

1250
1 20
1 9 1 11
RRBRRRRRRRBRRRRRRRRR
1 20
1 7 1 20
......RRRRRRRBBBBBBB
1 20
1 20 1 16
BBBBBBBBBBBBBBBBBBBR
1 20
1 10 1 5
RRRRBRRRRRRRRRRRRRRR
1 20
1 15 1 8
BBBBBBBBBBBBBRRRR...
1 20
1 14 1 8
.....RRBRRRRBRRRRRRR
1 20
1 2 1 19
RRRRRRRRRRRRRRRRRRBR
1 20
1 4 1 19
RRRRRRRRRRRRRRRRRBBB
1 20
1 19 1 6
...

output:

NO
YES
YES
NO
YES
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
YE...

result:

ok 1250 token(s): yes count is 371, no count is 879

Test #29:

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

input:

1250
20 1
7 1 8 1
B
B
B
B
B
B
R
B
B
B
.
.
.
.
.
.
.
.
.
.
20 1
2 1 16 1
R
R
B
R
R
R
R
R
R
R
R
.
.
B
B
B
B
B
B
B
20 1
15 1 7 1
.
.
B
B
B
B
B
B
B
B
B
B
R
B
R
B
R
.
.
.
20 1
3 1 13 1
B
B
R
B
B
B
B
B
B
B
B
B
B
B
B
B
.
.
.
.
20 1
10 1 19 1
.
.
.
.
.
.
.
B
B
R
B
B
B
B
B
B
B
B
B
B
20 1
11 1 9 1
R
.
.
R
R
R...

output:

NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
YES
YES
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
...

result:

ok 1250 token(s): yes count is 362, no count is 888

Test #30:

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

input:

1250
1 20
1 4 1 19
BRBRBRBRBBBRBRBR.BBR
1 20
1 5 1 8
RBRBRBRBRBRBRBRBRBRB
1 20
1 2 1 20
BRBRBRBRBRBRBRBRBRBB
1 20
1 1 1 20
RRBRBRBRRRBRBRBRBRBB
1 20
1 1 1 17
RBRBRBRBRBRBRBRBBBRB
1 20
1 1 1 14
R.RBRBRBRBRBRBRBBBRB
1 20
1 7 1 17
BBRBRBRBRBRBRBRBBBRB
1 20
1 14 1 9
BRBRBRBRBRBRBRB.BRBR
1 20
1 6 1 5
RBR...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 1250 token(s): yes count is 0, no count is 1250

Test #31:

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

input:

1250
20 1
1 1 17 1
R
B
B
B
B
B
R
B
R
B
R
B
R
B
R
B
B
B
R
B
20 1
18 1 16 1
R
R
B
R
B
R
B
R
B
R
B
R
B
R
B
B
B
R
B
B
20 1
3 1 10 1
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
R
B
20 1
19 1 4 1
R
B
R
B
B
B
R
.
R
B
R
B
R
B
R
.
.
B
R
B
20 1
3 1 20 1
B
R
R
R
B
R
B
R
.
R
B
R
B
.
B
R
B
R
B
B
20 1
17 1 3 1
R
B
B
B
R
...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 1250 token(s): yes count is 0, no count is 1250

Test #32:

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

input:

5
15 30
13 26 3 21
....................BBBBBBBBBB
....................B........R
..................RRBBBBBBBB.R
..................R.B......B.R
..................R.RRRRRR.B.R
..................R......R.B.R
..................RRRRRR.R.B.R
.......................R.R.B.R
.......................R.R.B.R
.....

output:

YES
NO
YES
YES
NO

result:

ok 5 token(s): yes count is 3, no count is 2

Test #33:

score: 0
Accepted
time: 6ms
memory: 4076kb

input:

25
100 100
67 10 25 57
BBBRRRRRRRBBRRRRBRBRRRBRRRBRBRRBRBRBRBRRRRRBRRBRRBBRBRBBRRBRRBBBRBRRBBRBBBBBBRBRRBRBBBRBBRRBRBBRRBBR
B...................................................................................................
BBRBBBRBRBRRRRBRRBRBBBRBRBRBBRRRBBRBBRBRBBBRRBRBRBBBBBRBBRRBRBBBRRBRRBBRBBR...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 25 token(s): yes count is 0, no count is 25

Test #34:

score: 0
Accepted
time: 6ms
memory: 4128kb

input:

25
100 100
80 81 62 54
B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.BBB.BB.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B.B
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB.BB.BBRBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
............................................BB.BB.............................

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 25 token(s): yes count is 0, no count is 25

Test #35:

score: 0
Accepted
time: 15ms
memory: 4388kb

input:

25
100 100
9 98 18 83
BRR.RBBBB.RBR.R.R.BRBBRR.BRBRB.B.BBR.R.BB.R.RBBRRRRB.RBRBBRBB...RBBBBBB.BRRBBB..RRBR.R.BR.RRRR.RRBRR
B.BRB.B..BB.B.BBBRB..R.RR..B.R.BRB.BBRRB.BRBR.B....BR.B.B...RR.BR.B....BB..R.BRR.B.RBRR.RRB..BBB..B.
R.R...RR.R.BBB..R..RR.BB.BBR.RR...R.R...BB..B.R.BBR.RR.BB.BR.B..B.RBBBBR.R.B...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO

result:

ok 25 token(s): yes count is 1, no count is 24

Test #36:

score: 0
Accepted
time: 12ms
memory: 4408kb

input:

25
100 100
13 3 7 7
.BBB.BBBBBBBBB.BBBBB.BBBBBBBBBB.B.B.BBB.BBBB.BB.B.BBBBBB.BBBBBB..BBBBBBB.BBBBB..B.BBB.BBB.BBB.BB.BBB
BB.B.B.B.B...BB....BBB.B...B.B.BBBBB.B.BB..BBB.BB.B....BBB.B.B.BBB.B..B.BB.B.BBBBBB.BBB.BBB.BB.BBB.B
B.BB.BB.BB.BB.BBBBB.B.BB.BBBB.BB...BBBBB.BB.B.BB.BB.BBB.B.BB.B.B...BBB.BB.BB.....

output:

NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
NO
NO

result:

ok 25 token(s): yes count is 4, no count is 21

Test #37:

score: 0
Accepted
time: 14ms
memory: 7460kb

input:

1
500 500
91 253 57 348
RRRBB.BBB..R.BBBR.BRB..B.RR.BRRBRBBB.RR.RB.BBRRRB.BBRRB.BR.R..RBRR.BBBRRBBBR.RRR.BRBRBB..BBRR..RBR.RBR.B.RBBR.BB.BRRBRRBBBB.B...B.RRBRB.BRRB.RRRBBB.RRB.RBRBBB.B.RRRBBBRR.RB.RBB.R.BRR.RBRB.RRR.RBRRR.RB.BBBR..RBRBR.BBBBR.B..BBBR.R.RBRBRBB..R.RBR.RB.R.R.RBB..BBB.BRBRRBBBRRBBR.BB...

output:

NO

result:

ok NO

Test #38:

score: 0
Accepted
time: 7ms
memory: 7104kb

input:

1
500 500
422 443 206 82
RRBRBRBBBBBRBBBBBBRRBRRBRRRRBRBBBBBBRRRBBRBRBRBRRRRRRBBRRBBRRBRRBBBRBBRRRRRRBBBRRRRBBBBRBBBBRRRBRRRBRRRRRBRBRRRBBBBBRBRRBRRRRRBBRRRRBRRRRBBRRBRBBBRBRBBBRBRRRBRBRBBRRBBBRRRBBBRBBBBRRRRBBRBBRRRBRBRRBRBBBBBBRBRRRRRRRBRBBBBRBRBRBRBRRRRRRBRRBBBBRRBRBBRBBRRBRRRRBRRBRBRBRRRRBRRRRRB...

output:

NO

result:

ok NO

Test #39:

score: 0
Accepted
time: 6ms
memory: 7420kb

input:

1
500 500
424 484 334 29
B.B.B.B.B.R.R.R.R.B.R.R.R.B.B.B.B.R.B.R.R.B.R.B.R.B.R.B.R.R.R.B.B.B.R.B.B.B.R.B.R.B.B.B.B.B.B.B.B.R.B.R.B.R.B.R.R.R.R.B.B.B.R.B.B.B.B.B.B.R.B.R.B.B.R.B.B.B.B.B.B.R.R.B.B.R.R.R.R.R.B.R.B.B.B.B.R.R.B.B.R.R.R.B.B.R.R.B.R.R.B.B.B.R.R.B.B.R.R.B.B.B.R.R.B.R.R.B.R.B.R.R.R.B.B.B.B.B...

output:

NO

result:

ok NO

Test #40:

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

input:

1
500 500
380 418 244 366
.B.B.R.R.R.R.B.R.R.B.B.B.R.B.B.R.B.B.B.B.R.B.B.B.R.R.R.R.R.R.R.B.R.B.R.B.R.B.B.B.R.B.R.B.R.B.R.R.B.B.B.R.B.R.R.B.B.R.R.B.B.R.R.R.R.B.R.B.B.R.R.R.R.B.R.B.R.B.R.B.R.R.B.B.B.B.R.R.R.R.R.B.R.R.B.R.R.B.R.R.R.B.R.B.R.B.B.R.R.B.R.B.R.B.B.B.R.R.B.R.R.B.R.B.R.B.R.R.R.R.R.R.B.R.R.B.R...

output:

NO

result:

ok NO

Test #41:

score: 0
Accepted
time: 11ms
memory: 7120kb

input:

1
500 500
52 5 62 168
BBB.BBB..BBBB.BBBBBB.BBBBBB.BBBBBBB.BB.BBBB.BBBBB..BBB.BBBBBBB.BBBBB.BB.BBBB.B.BBBBBBBBBBBBB..B.BB.BBB..BBB.BB.BBB..BBBBBB.BBBBB.B.BBB.BBBBBBBBBBBBB..BBB.BBBBB.BBBBBB.B.BBB.BBBBB.B.B.BB.BBBBBB..BBBBBB.BBBBB.BBBBBBBBB.B.BBB.BBBB.BBBB.BB.BBBBBBBB...BBBBBBBBB.BBBBBBBBBBBB.B.B.BBBB...

output:

NO

result:

ok NO

Test #42:

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

input:

1
500 500
414 95 356 84
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

NO

result:

ok NO

Test #43:

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

input:

10000
1 7
1 6 1 7
.....RB
1 7
1 7 1 6
.....BR
1 7
1 5 1 7
....R.B
1 7
1 5 1 7
....RRB
1 7
1 6 1 7
....RRB
1 7
1 5 1 6
....RB.
1 7
1 5 1 6
....RBR
1 7
1 7 1 6
....RBR
1 7
1 5 1 6
....RBB
1 7
1 5 1 7
....RBB
1 7
1 7 1 5
....B.R
1 7
1 6 1 5
....BR.
1 7
1 6 1 5
....BRR
1 7
1 7 1 5
....BRR
1 7
1 6 1 5
.....

output:

YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
...

result:

ok 10000 token(s): yes count is 858, no count is 9142

Test #44:

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

input:

10000
7 1
6 1 7 1
.
.
.
.
.
R
B
7 1
7 1 6 1
.
.
.
.
.
B
R
7 1
5 1 7 1
.
.
.
.
R
.
B
7 1
5 1 7 1
.
.
.
.
R
R
B
7 1
6 1 7 1
.
.
.
.
R
R
B
7 1
5 1 6 1
.
.
.
.
R
B
.
7 1
5 1 6 1
.
.
.
.
R
B
R
7 1
7 1 6 1
.
.
.
.
R
B
R
7 1
5 1 6 1
.
.
.
.
R
B
B
7 1
5 1 7 1
.
.
.
.
R
B
B
7 1
7 1 5 1
.
.
.
.
B
.
R
7 1
6 1 ...

output:

YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
...

result:

ok 10000 token(s): yes count is 858, no count is 9142

Test #45:

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

input:

1000
9 1
7 1 9 1
R
R
R
R
R
R
R
R
B
10 16
10 2 1 6
....RBBBB.......
.R..R..B........
.R.RR...........
RRRRRR..........
RRRRRR..........
RRR.R...........
RRRRRRR.........
RRB.R...........
RRRRR...........
RRRRR...........
2 17
1 10 1 12
RRRRRRRRRRRBBBBB.
RRBRRRRRRBBBBBBBB
14 20
1 4 13 4
...R.B...........

output:

YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
...

result:

ok 1000 token(s): yes count is 863, no count is 137

Test #46:

score: 0
Accepted
time: 21ms
memory: 6848kb

input:

22
161 15
25 12 10 13
RRRRRBBRBBRRRRB
RRRRRRRRBBRBRBR
RBRRRRRRBRRRRRR
BBBRRRRRBRRRRBR
BBRRRRRRBRRRRRR
RRBBRRRRBRRRRRR
RRRRRRRRBRRRRRR
RRRBRBRBRRBRRRR
RRRRRRBRBRBRRRB
RRBRRRRRRRRRBRB
BBRRRRRBRBRRRRR
RBRRRRRRRBRRRRR
RRRRRRRRBRRRRRB
RBBRBRBRRRRRRRR
BRRRRRRRBRBBRBR
RRRRRRRRRBRRRBR
RRBRRRRBBRRRBRR
BRRBRR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES

result:

ok 22 token(s): yes count is 21, no count is 1

Test #47:

score: 0
Accepted
time: 35ms
memory: 38568kb

input:

10000
479 480
115 458 173 109
BBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 10000, no count is 0

Test #48:

score: 0
Accepted
time: 33ms
memory: 35540kb

input:

10000
458 458
261 319 174 53
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
Y...

result:

ok 10000 token(s): yes count is 9949, no count is 51

Test #49:

score: 0
Accepted
time: 33ms
memory: 28004kb

input:

10000
400 400
57 134 366 122
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRRRRRRRRRRRRBRRRRRRRRRRRRRRRR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 9981, no count is 19

Test #50:

score: 0
Accepted
time: 38ms
memory: 17424kb

input:

10000
300 300
100 184 216 41
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
...

result:

ok 10000 token(s): yes count is 9958, no count is 42

Test #51:

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

input:

9
1 2
1 1 1 2
RB
1 5
1 1 1 5
RRBBB
1 5
1 1 1 5
RBRBB
1 5
1 1 1 3
RRBRR
2 5
1 1 1 3
RRBRR
..B..
3 3
1 1 3 3
R..
...
..B
3 10
1 5 1 6
RRRBRBBBBB
R........B
RRRRRRRRRB
10 10
2 2 8 8
.RB.......
BRRRRRRRRR
B........R
RBBBBBBB.R
B......B.R
BRRRRR.B.R
B......B.R
BBBBBB.BRB
.....B.R.R
BBBBBB.BRB
10 10
5 3 7...

output:

YES
YES
NO
NO
NO
YES
NO
YES
YES

result:

ok 9 token(s): yes count is 5, no count is 4

Test #52:

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

input:

10000
1 25
1 21 1 11
RRRRRRRBRRBRRRRRRBRBRRRBB
1 25
1 11 1 15
BBBBBRBBRBRRRBBBBBBRRBBRR
1 25
1 12 1 25
.RBBBBBRBBBRRBB.RBRBRRRRB
1 25
1 18 1 8
BBRRRBRBBBBBRBBRRRBBBRRRB
1 25
1 19 1 6
R.BRBBRBRBRRRBRBRRRRRRBBR
1 25
1 14 1 12
RRBRRBBRBBRBRRRBRRRBBRBRR
1 25
1 24 1 7
RBBBRRBRBBBBRBRBRRRBRRBRB
1 25
1 23 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 10000 token(s): yes count is 0, no count is 10000

Test #53:

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

input:

10000
1 25
1 4 1 2
RBRRRRRBRBRRRRRRBRRRRBRRR
1 25
1 1 1 17
RRRRRBRRRRRRBRRRBRRRRRRBR
1 25
1 15 1 21
RRRRBRRRRRBRRRRRRRRRBRRRR
1 25
1 17 1 25
RRRRRRRR.RRRRRRRRRRRRRRRB
1 25
1 25 1 5
RRRRBRRRRRRBRRRRRRRRRBRRR
1 25
1 6 1 14
RRRRRRBRRRRRRBBRRRRRRRRRR
1 25
1 9 1 4
RRRBBRRBRRRRRRRRRRRBRRR.R
1 25
1 8 1 21
...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 10000 token(s): yes count is 162, no count is 9838

Test #54:

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

input:

10000
1 10
1 2 1 10
BRBRB.RRRB
1 10
1 3 1 6
BRRBBBBRRR
1 10
1 2 1 5
BRRBBBBBBR
1 10
1 9 1 10
BBRBBBRRRB
1 10
1 6 1 4
RRRBBRBBRR
1 10
1 10 1 4
RBRBRRBRBR
1 10
1 5 1 7
BRBBRBBRBB
1 10
1 1 1 2
RBBBRRBBRR
1 10
1 8 1 7
BRRRRRBRBB
1 10
1 1 1 4
RR.BRBRBBB
1 10
1 9 1 2
BBBBBBBBRR
1 10
1 7 1 8
BRBBRRRBRB
1 1...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
N...

result:

ok 10000 token(s): yes count is 141, no count is 9859

Test #55:

score: 0
Accepted
time: 12ms
memory: 3980kb

input:

10000
1 9
1 5 1 8
RRRBRBBBB
1 9
1 4 1 1
BBRRRRRRB
1 9
1 2 1 8
BRRBRBBBR
1 9
1 5 1 9
BRRBRBBRB
1 9
1 4 1 6
RRBRRBRRB
1 9
1 8 1 7
RRBRRRBRR
1 9
1 9 1 4
BRBBRBRRR
1 9
1 8 1 6
RBRBRBBRR
1 9
1 1 1 7
RRBBRBBRB
1 9
1 6 1 7
B.BRRRB.R
1 9
1 2 1 8
BRRRRRRBB
1 9
1 9 1 7
BBRRRBBRR
1 9
1 4 1 1
BBRRBBBRB
1 9
1 6 ...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO...

result:

ok 10000 token(s): yes count is 303, no count is 9697

Test #56:

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

input:

10000
1 8
1 7 1 8
......RB
1 8
1 8 1 7
......BR
1 8
1 6 1 8
.....R.B
1 8
1 6 1 8
.....RRB
1 8
1 7 1 8
.....RRB
1 8
1 6 1 7
.....RB.
1 8
1 6 1 7
.....RBR
1 8
1 8 1 7
.....RBR
1 8
1 6 1 7
.....RBB
1 8
1 6 1 8
.....RBB
1 8
1 8 1 6
.....B.R
1 8
1 7 1 6
.....BR.
1 8
1 7 1 6
.....BRR
1 8
1 8 1 6
.....BRR
...

output:

YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
YES
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
YES
YES
YES
NO
NO
NO
NO
...

result:

ok 10000 token(s): yes count is 858, no count is 9142

Test #57:

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

input:

4400
7 8
3 7 3 3
..BBRR..
..B..B..
RBBBRRRB
R.R..B.B
R.RBBB.B
B......B
BBRBRBRB
7 8
2 3 6 1
..BRBR..
..R..R..
BRBBRRRR
R.B..B.B
R.RBBB.B
B......R
RBBBBRBR
7 8
7 5 3 3
..RRBB..
..B..B..
BBBRRBBB
B.B..R.B
R.RRRR.R
R......B
RRBBRRBB
7 8
5 5 7 5
..BRBB..
..R..B..
BRRBBBRB
B.R..B.R
R.RBRR.B
R......B
BRRB...

output:

NO
YES
NO
YES
NO
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
NO
YES
NO
NO
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
YES
NO
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
NO
YES
YES
YES
...

result:

ok 4400 token(s): yes count is 3313, no count is 1087

Test #58:

score: 0
Accepted
time: 22ms
memory: 3676kb

input:

4400
7 8
4 6 4 8
..RRRB..
..R..R..
BRRRRRBR
B.B..R.B
R.RRRB.B
R......R
RRRRBRRR
7 8
2 6 1 5
..RBBR..
..R..R..
BBRRRBRR
R.B..B.R
R.RBBR.B
R......R
RRRRRRRR
7 8
7 6 1 4
..RBRR..
..B..R..
RRRRRBBB
R.B..R.R
R.RRRR.R
R......R
RBRRRRRR
7 8
4 8 5 3
..RBRR..
..R..R..
BRRRRRBR
B.R..R.R
B.BRBR.B
R......B
RRRR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
NO
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
NO
NO
YES
YES
YES
YES
YES
Y...

result:

ok 4400 token(s): yes count is 3601, no count is 799

Test #59:

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

input:

4400
7 8
3 4 5 3
..RRRR..
..R..R..
RRRRRRRR
R.R..B.R
R.BRRR.R
R......R
RBRRRRRR
7 8
3 7 6 8
..RRRR..
..R..R..
RRRRRRRR
R.R..R.R
R.BRRR.R
R......B
RRRRRRRR
7 8
4 3 7 6
..RRRR..
..R..R..
RRRRRRRR
R.R..R.R
R.RRRR.R
R......R
RRRRRBRR
7 8
7 8 5 8
..RRBR..
..R..R..
RRRRRRRR
R.R..R.R
R.RRRR.B
R......R
RRRR...

output:

YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YE...

result:

ok 4400 token(s): yes count is 4165, no count is 235

Test #60:

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

input:

4400
7 8
5 4 1 6
..BBBB..
..B..B..
BRBBBBBB
B.B..B.B
B.BRBB.B
R......B
BBBBBBBB
7 8
2 6 5 3
..BBBB..
..B..R..
BBBBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBBBBBB
7 8
4 1 3 7
..BBBB..
..B..B..
BBBBBBBB
R.B..B.B
B.BBRB.R
B......B
BBBBBBBB
7 8
7 6 6 8
..RBBB..
..B..B..
BBBBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBB...

output:

YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
NO
YES
YES
YES
YES
YES...

result:

ok 4400 token(s): yes count is 4176, no count is 224

Test #61:

score: 0
Accepted
time: 19ms
memory: 3980kb

input:

4400
7 8
3 3 3 6
..BBRR..
..B..B..
RBRBRBRB
R.R..B.B
R.RBBB.B
B......B
BBRBRBRB
7 8
3 3 3 6
..RRRR..
..B..B..
RBRRBBBR
B.R..R.R
B.RBBB.B
R......B
BRRBBRRB
7 8
3 3 3 6
..BRBR..
..B..B..
RRRBBBBB
B.B..R.R
B.RRRB.R
R......R
RBBBBRBB
7 8
3 3 3 6
..BBRR..
..R..B..
RBRBRBBB
R.B..R.R
B.BBRR.R
B......R
BBRR...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 4400 token(s): yes count is 0, no count is 4400

Test #62:

score: 0
Accepted
time: 17ms
memory: 3676kb

input:

4400
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..B.R
R.BRRR.R
R......R
RBRRRRRR
7 8
3 3 3 6
..RBRR..
..R..R..
RRRRRBRR
R.R..R.R
R.RRRR.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..B..
RRRRRBRR
R.R..B.R
R.RRRR.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..R.R
R.RBRB.R
B......R
RRRR...

output:

NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
YES
NO
YES
YES
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
...

result:

ok 4400 token(s): yes count is 1047, no count is 3353

Test #63:

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

input:

4400
7 8
3 3 3 6
..BBBB..
..B..B..
BRRBBBBB
B.B..B.B
B.BRBB.B
R......B
BBBBBBBB
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
R.B..B.B
B.BBBB.B
B......B
BBRBBBBR
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBR.B
B......B
BBBBBBBB
7 8
3 3 3 6
..BBBB..
..B..R..
BBRBBBRB
B.B..B.B
B.BBBB.B
B......B
BBBB...

output:

NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
NO
YES
NO
NO
NO
YES
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
YES
Y...

result:

ok 4400 token(s): yes count is 1079, no count is 3321

Test #64:

score: 0
Accepted
time: 18ms
memory: 3676kb

input:

4400
7 8
3 3 3 6
..RBBB..
..B..B..
BBRBBBBB
B....B.R
B.BBRB.B
B......B
BBBBBB.B
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBB.B
B......B
.BBBBBBB
7 8
3 3 3 6
..RBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBBBBB.
7 8
3 3 3 6
..BBB...
.....B..
BBRBBBBB
B.B..B.B
..BBBB.B
B......B
B..B...

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
...

result:

ok 4400 token(s): yes count is 266, no count is 4134

Test #65:

score: 0
Accepted
time: 11ms
memory: 3676kb

input:

4400
7 8
3 3 3 6
........
........
..R..B..
........
........
........
........
7 8
3 3 3 6
........
.....B..
..R..B..
..B....R
........
........
......B.
7 8
3 3 3 6
....RB..
..R.....
..R..B..
........
........
........
.B......
7 8
3 3 3 6
........
........
..R..B..
B.......
.....R.B
........
.......

output:

YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
N...

result:

ok 4400 token(s): yes count is 236, no count is 4164

Test #66:

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

input:

25
100 100
25 71 63 73
.........................................R..........................................................
....................................................................................................
..............................................................................

output:

NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO

result:

ok 25 token(s): yes count is 0, no count is 25

Test #67:

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

input:

25
100 100
21 100 40 32
....................................................................................................
....................................................................................................
.............................................................................

output:

YES
NO
NO
NO
YES
NO
YES
YES
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
NO
YES
NO
NO
YES
YES

result:

ok 25 token(s): yes count is 12, no count is 13

Test #68:

score: 0
Accepted
time: 21ms
memory: 3700kb

input:

4400
7 8
3 3 3 6
..RRRR..
..R..B.R
RRRRRBRR
R.R..R.R
R.RRRR.R
R..B...R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..R.B
RBRRRBRR
R.R..R.R
R.RRRR.R
R......R
.RR.RRRR
7 8
3 3 3 6
..RRRR..
..R.BR..
RRRRRBRR
R.R..R.R
R.RRRR.R
R..B...R
RRRBRRRB
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..R.R
R.RRRR.R
R......R
RBRB...

output:

YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
YE...

result:

ok 4400 token(s): yes count is 1031, no count is 3369

Test #69:

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

input:

4400
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
B.RR.R.B
R.RRRR.R
R......R
RRRRBRBR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..R.R
R.RRRR.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..R.R
R.BRRR.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.B..R.R
R.RRRR.R
R......R
RRRR...

output:

NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
YES
NO
YES
NO
YE...

result:

ok 4400 token(s): yes count is 1029, no count is 3371

Test #70:

score: 0
Accepted
time: 17ms
memory: 3764kb

input:

4400
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
R.R..R.R
R.RRRR.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBBR
R.R..R.R
R.RRRB.R
R......R
RRRRBRRR
7 8
3 3 3 6
..RRRR..
..R..R..
RRRRRBRR
..B.BR.R
R.RRRB.R
R......R
RRRRRRRR
7 8
3 3 3 6
..RRRR..
..B..R..
RRRRRBRR
R.R..R.R
RBRRRR.R
R......R
RRRR...

output:

YES
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
YES
NO
NO
YES
NO
NO
YES
YES
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
Y...

result:

ok 4400 token(s): yes count is 1042, no count is 3358

Test #71:

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

input:

4400
7 8
3 3 3 6
..BB.B..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBBBBBB
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBBBBRB
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.BBBB.B
B......B
BBBBBBBB
7 8
3 3 3 6
..BBBB..
..R..B..
BBRBRBBB
B.B..B.B
B.BBBB.B
B......B
BRBB...

output:

NO
NO
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
YES
YES
NO
NO
NO
YES
YES
YES
YES
YES
NO
YES
YES
NO
NO
YES
NO
NO
NO
NO
YES
YES
NO
NO
NO
NO
YES
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
YES
YES
YES
NO
YES
NO
NO
YES
NO...

result:

ok 4400 token(s): yes count is 1052, no count is 3348

Test #72:

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

input:

4400
7 8
3 3 3 6
..BBBB..
..B..B..
BBRBBBBB
B.B..B.B
B.RBBB.B
B......B
BBBBBBBB
7 8
3 3 3 6
..BBBB..
..B..B..
BBRRBBBB
B.B..B.B
B.BBBB.B
B......B
RBBBBRBB
7 8
3 3 3 6
..BBBB..
..R..B..
BBRBBBBB
B.B..B.R
B.BBBB.B
B......B
BBBRBBBB
7 8
3 3 3 6
..BBBB..
..B..B..
RBRBBBBB
B.B..B.R
B.BBBB.B
B......B
BBBB...

output:

NO
NO
NO
NO
NO
YES
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
NO
NO
NO
YES
YES
YES
NO
NO
YES
NO
NO
NO
NO
NO
NO
NO
NO
NO
NO
YES
YES
NO
NO
YES
NO
YES
NO
YES
NO
NO
NO
NO
NO
YES
YES
NO
NO
NO...

result:

ok 4400 token(s): yes count is 1062, no count is 3338

Extra Test:

score: 0
Extra Test Passed