QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#743308#5077. Card Gameucup-team5062#AC ✓205ms45912kbC++202.6kb2024-11-13 18:54:152024-11-13 18:54:21

Judging History

你现在查看的是最新测评结果

  • [2024-11-13 18:54:21]
  • 评测
  • 测评结果:AC
  • 用时:205ms
  • 内存:45912kb
  • [2024-11-13 18:54:15]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

int H, W;
int Index1[59][59];
int Index2[59][59];
int dp[59][59][59][59];
char C[59][59];

int dfs(int lx, int rx, int ly, int ry, int t) {
    if (dp[lx][rx][ly][ry] >= 0) return dp[lx][rx][ly][ry];
    bool ret[319];
    for (int i = 0; i < 319; i++) ret[i] = false;

    // Solve
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            if ((i + j) % 2 != t) continue;
            if (!(lx <= Index1[i][j] && Index1[i][j] <= rx)) continue;
            if (!(ly <= Index2[i][j] && Index2[i][j] <= ry)) continue;

            // Get Result
            int result = 0;
            if (C[i][j] == 'B') {
                int v1 = dfs(lx, rx, ly, Index2[i][j] - 1, t);
                int v2 = dfs(lx, rx, Index2[i][j] + 1, ry, t);
                result = (v1 ^ v2);
            }
            if (C[i][j] == 'R') {
                int v1 = dfs(lx, Index1[i][j] - 1, ly, ry, t);
                int v2 = dfs(Index1[i][j] + 1, rx, ly, ry, t);
                result = (v1 ^ v2);
            }
            if (C[i][j] == 'G') {
                int v1 = dfs(lx, Index1[i][j] - 1, ly, Index2[i][j] - 1, t);
                int v2 = dfs(lx, Index1[i][j] - 1, Index2[i][j] + 1, ry, t);
                int v3 = dfs(Index1[i][j] + 1, rx, ly, Index2[i][j] - 1, t);
                int v4 = dfs(Index1[i][j] + 1, rx, Index2[i][j] + 1, ry, t);
                result = (v1 ^ (v2 ^ (v3 ^ v4)));
            }

            // Update
            if (result < 319) ret[result] = true;
        }
    }

    // Update
    for (int i = 0; i < 319; i++) {
        if (ret[i] == false) {
            dp[lx][rx][ly][ry] = i;
            return i;
        }
    }
    return -1;
}

int main() {
    // Step 1. Input
    cin >> H >> W;
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) cin >> C[i][j];
    }

    // Step 2. Solve Init
    for (int i = 0; i < H; i++) {
        for (int j = 0; j < W; j++) {
            Index1[i][j] = i + j + 1;
            Index2[i][j] = i - j + W + 1;
        }
    }

    // Step 3. Solve Main
    int Answer[2] = {0, 0};
    for (int t = 0; t < 2; t++) {
        for (int i = 0; i <= H + W; i++) {
            for (int j = 0; j <= H + W; j++) {
                for (int k = 0; k <= H + W; k++) {
                    for (int l = 0; l <= H + W; l++) dp[i][j][k][l] = -1;
                }
            }
        }

        // Solve
        Answer[t] = dfs(0, H + W, 0, H + W, t);
    }

    // Step 4. Output
    int x = (Answer[0] ^ Answer[1]);
    cout << (x == 0 ? "L" : "W") << endl;
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

1 3
BBB


output:

W

result:

ok single line: 'W'

Test #2:

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

input:

2 3
BBG
RGR


output:

W

result:

ok single line: 'W'

Test #3:

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

input:

2 2
GG
GG


output:

L

result:

ok single line: 'L'

Test #4:

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

input:

1 10
RRRRRRRRRR

output:

L

result:

ok single line: 'L'

Test #5:

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

input:

1 11
BBBBBBBBBBB

output:

W

result:

ok single line: 'W'

Test #6:

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

input:

10 1
G
G
G
G
G
G
G
G
G
G

output:

L

result:

ok single line: 'L'

Test #7:

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

input:

11 1
R
R
R
R
R
R
R
R
R
R
R

output:

W

result:

ok single line: 'W'

Test #8:

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

input:

2 20
BBGGBGBGGBBGGBGGBGGG
GGBBBGBGBBBGBGGGGGGG

output:

L

result:

ok single line: 'L'

Test #9:

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

input:

2 20
GBGBGBBBGGGGGBGGBBBB
GGGBBBGBGBGBGGBGBGGB

output:

W

result:

ok single line: 'W'

Test #10:

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

input:

2 21
GBBBBBBGGBGGBBBGBGGBG
GBBBGBBBGBBBGGBGBBGBB

output:

L

result:

ok single line: 'L'

Test #11:

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

input:

2 21
GGGBBBGBBGBGGBBGGGBGG
BGBBGBBBBBBGBBBBGGGBB

output:

W

result:

ok single line: 'W'

Test #12:

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

input:

20 2
BG
GG
BG
GB
BB
GB
BG
GG
BB
BB
BB
BB
BG
BB
BG
GG
BB
BG
GB
BG

output:

L

result:

ok single line: 'L'

Test #13:

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

input:

20 2
BB
GB
GG
GG
GB
BG
GG
GB
BB
BB
GG
GB
BB
BG
BB
BB
BG
BG
BG
BG

output:

W

result:

ok single line: 'W'

Test #14:

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

input:

21 2
GB
BG
BB
BG
GB
BG
BG
BG
GG
GG
GB
BG
GG
GB
GB
BG
GB
BG
BG
GG
GB

output:

L

result:

ok single line: 'L'

Test #15:

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

input:

21 2
BG
BB
GG
GB
BG
BB
GB
GG
BG
GG
BB
GG
BG
BB
GB
GB
GB
BG
BB
BG
GG

output:

W

result:

ok single line: 'W'

Test #16:

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

input:

2 20
BRRBBBBRBBBBBBBRBBBB
RBRRRBRBBBBRRRBBBRRR

output:

L

result:

ok single line: 'L'

Test #17:

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

input:

2 20
BRBBBBBRRRBBRBRBRRBB
BBBBRBRRRBBRRRRRBBBB

output:

W

result:

ok single line: 'W'

Test #18:

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

input:

2 21
BBRRRRRBRBRRBRBBRBRBR
RBBRBBRRRRRBRBBBRRBBB

output:

L

result:

ok single line: 'L'

Test #19:

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

input:

2 21
RBBBRBBBBBBBRRRRRRRBB
BRRRRRBRBBRBBBBRBRBRR

output:

W

result:

ok single line: 'W'

Test #20:

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

input:

20 2
BB
BR
BB
BB
RR
RR
RR
BB
BR
RR
BR
RR
BR
BB
BR
BB
RR
BB
BR
BR

output:

L

result:

ok single line: 'L'

Test #21:

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

input:

20 2
BB
RR
RR
BR
BB
BR
RR
RB
BR
RB
RB
RR
RB
RB
BB
BR
BR
RR
BR
RR

output:

W

result:

ok single line: 'W'

Test #22:

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

input:

21 2
BR
BB
BB
BB
BR
RR
RB
BR
BB
RB
RR
RR
RB
BB
RR
BR
BR
RR
RB
RR
RB

output:

L

result:

ok single line: 'L'

Test #23:

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

input:

21 2
BR
BR
BB
BB
BR
BB
RB
RB
RR
RR
RR
RB
RB
RB
RB
BR
RB
BB
BB
BB
BR

output:

W

result:

ok single line: 'W'

Test #24:

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

input:

3 24
GGRGGGRGRGGRRGGGRRGRRGGR
RGRRGGGGRGRGGGGGRRRRGGGG
GRRGGRRRGGGGRRGRGGGGRRGG

output:

L

result:

ok single line: 'L'

Test #25:

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

input:

3 24
GGGRGRGGRGRGRGGRGGGRRRRR
RRRRGGRGRGGGRRGRGRRRGRRR
GGRGGRGRRRRGGGGGGRGRGRRR

output:

W

result:

ok single line: 'W'

Test #26:

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

input:

3 25
RRRRRGRRGGRRRRRRGRGGRRRGG
GGGGRGRGGRRRRRGRGRGRGRRRR
RGGRRRRRGGGGGRRRGGGGGGGRG

output:

L

result:

ok single line: 'L'

Test #27:

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

input:

3 25
RRGRGRRGRGRGGRGGRRGGRRRGG
RGRRGRRGRGGGGGRGGRRRGGGGG
RRGGRRGRGGGGGRGRGRRRRGRRG

output:

W

result:

ok single line: 'W'

Test #28:

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

input:

24 3
RGG
GRG
GRR
GGG
GGG
RGR
GRG
RGG
RRG
GRR
GGR
GRR
GGR
GRR
RGR
RGR
GRR
GRG
RGR
RRG
RRG
RGR
GGG
RRG

output:

L

result:

ok single line: 'L'

Test #29:

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

input:

24 3
GRG
GGR
RGG
GRR
RRR
GRR
RRG
GGR
GGR
RGR
GRR
GGR
RGR
GRR
RRG
GGR
GRR
RGR
GRG
GGG
GRG
RRR
RRG
GRG

output:

W

result:

ok single line: 'W'

Test #30:

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

input:

25 3
RGR
RGG
GGG
GGR
RGG
GGR
GGR
RRG
GGG
GGR
GRR
GRG
RRR
GGG
RGG
RGG
GRG
RGG
RRR
GGG
RGR
RGR
RGG
GRG
GGR

output:

L

result:

ok single line: 'L'

Test #31:

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

input:

25 3
RRG
RGG
GRR
RGG
RGG
RRR
RRR
GRG
GRG
GGG
RGG
RRG
RRG
RRG
GGR
GGG
GGG
RGR
GGG
GGR
GGR
GRG
RRG
RGG
GRG

output:

W

result:

ok single line: 'W'

Test #32:

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

input:

3 24
RRRBBRBBBBBBBBBBBBBBRBRR
BRBRRBBRBRBRRBBRRBRBBBBB
RRBRBBBRBBBRBRBBBBBBBBRB

output:

L

result:

ok single line: 'L'

Test #33:

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

input:

3 24
BRBRRBBRBRRBRRRBBBRBRRBB
BRBBRBBBBBRBRRRBRRRRRBBR
BRBRBBRRRBRBRRBBBBRRBRRB

output:

W

result:

ok single line: 'W'

Test #34:

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

input:

3 25
BBRRBBBBBBBRBBBRBRBRBRBBB
RRRBBBBRRRRBRRRRRBBBBRBRB
RRRRRBRRBRRBRBRRRBBRRBRRR

output:

L

result:

ok single line: 'L'

Test #35:

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

input:

3 25
BBRBBBBBRBBBBBRRRRRRBBRRB
RRRBBRRRBBRBBBRRRBBBBBRBR
BBRBRRRBRBBRRRRRRRRBBRRRB

output:

W

result:

ok single line: 'W'

Test #36:

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

input:

24 3
RBR
RBB
BRB
BBR
BRR
BRR
RRR
BBR
RBR
RBB
RBR
RBR
BBB
BBB
BBR
RRB
RRB
RBR
RRR
RRB
BRB
RRR
BBR
RBB

output:

L

result:

ok single line: 'L'

Test #37:

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

input:

24 3
RRR
RBB
BBR
RBB
RBB
BRR
BBR
BRR
BBB
BBR
RRB
RRR
RBB
RRR
RRB
RRR
RRB
RRR
RBB
RBR
RRB
BRB
RBR
BBB

output:

W

result:

ok single line: 'W'

Test #38:

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

input:

25 3
BBR
BRB
RBB
RRR
BBR
RRR
RBB
BBR
BRR
RBR
RBR
BRR
BBB
RBR
BBB
BRB
BBB
RRB
RRB
RBB
BRB
RRB
RRR
BBB
RRB

output:

L

result:

ok single line: 'L'

Test #39:

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

input:

25 3
BBB
BRB
BBB
RRR
RBR
BBB
RBR
BBR
BRB
RBR
RRR
RRR
RBB
BBB
RBR
RRR
RBB
BBB
BBR
RBB
BRR
RBB
RBB
RBR
BBB

output:

W

result:

ok single line: 'W'

Test #40:

score: 0
Accepted
time: 110ms
memory: 41056kb

input:

22 22
RBRGRBGRGGGBRRRBRBBBRG
RBGBRGBGRBBGRGGBRRBRRG
GGRBGGRRBBGRBBGBBGRGGG
GBBBGBBGGBBGGGGBGGGRRG
BBBRBGRBGRGRBGRBRGBBBG
RGRGGBRBBRRBBBBBBRRGRG
BBBGRRGRRRBBGGBRRGRGGR
GRGGGGGBBRGRRRRGBRRRRG
BRGBRBGBGGRGGRRGGGGBGB
GBRBGGRGRGRGGRBBGGGGRB
RBRGBGBBBGBBBGBGBGGBBB
RBBBBBBGBBRBRRBBRGBBGR
RGBBBGBRRGGRGBBRGG...

output:

L

result:

ok single line: 'L'

Test #41:

score: 0
Accepted
time: 99ms
memory: 40812kb

input:

22 22
BBGGBGGBGRRBGBRRRGBGGB
RRRRGRBGBBRGBGRRBRRGRB
RBRRBBGGRBBGBGGRBRBRBB
BRRRRRBGRGGRBGBGRRRGGG
BGRBRRGRRRRBBRGGRGRGGB
RRGBRBRBGGRGGBGGRGRBBR
BRGRRRRBBBRRBGRGRRGRGB
RRRRRBBBGGGRBBRBGRGGGB
GGRBRRGGGGRBGGBRBGRBRR
GGGRBGGRRRGBRRGGRRBGBG
GBGBBBBRGBGBBRRBBBGBBG
BRBGGBBBRRGRGBRBGRRRGG
RBBRBBRGRRRRGRRRRB...

output:

W

result:

ok single line: 'W'

Test #42:

score: 0
Accepted
time: 106ms
memory: 39644kb

input:

22 22
GGRBGRRGGRRRBRGRBBBRRG
GGGBRBRRGGRRRBRRBRGGGB
GBRBGGGRRBGRRRBRRRGRBB
RRRBBGRGRRGGGRGBGRGGBB
RBBRRRGBBBGGRBRRGBBGBR
GBGBGRRBRBBBRBGGGRGRGB
BBGBGRGRGBGRGRRBBBBRBR
GBGRRRGRGBGGBRGRBBGGRR
GGGBBGGGBRRGRGBBRBRGBB
RRBGBBGBBGGGBRGBRGBRRB
GGGBRRBGRGGGGBGBBRRBRR
BRRRRRRRBGGRBBBGBGGBRR
BBRRGBRRGBRRBRRRGB...

output:

L

result:

ok single line: 'L'

Test #43:

score: 0
Accepted
time: 97ms
memory: 40036kb

input:

22 22
RRGGGRRBGRGRGBBGBRBBBR
BBBRGBGGRGRBBBRGBRGBGG
RRGBRRRGGBBBBRRGGBBRBR
RBRRGRBGGGRBBRRRBRRRGR
RGRBBBBRGRRRGGGBBRGRGG
GBGBGGGBRBRBBGRBRGGGBB
RRGGBGGBRGBRRGBBBRRRRR
RGGGRRBBBGBRGGGBGBGRBG
BGGRGGRRRBBBBBBBGGGBBR
BGBGBGRGRGBBRRBBRRRGBG
BGGBGBGRGRRBRRRBGRBGRR
RGRGGBBBRRBRBRRGRGBBGG
GGBBGRRGRRGBGBBGGG...

output:

W

result:

ok single line: 'W'

Test #44:

score: 0
Accepted
time: 145ms
memory: 42832kb

input:

25 22
GRGGRRGBGBBGBGGRGGRBBG
GRBGRGRRRBBRRRBGGGBRBR
BGBGGBGBGBGGRGBRRGBGRB
RBGRGGBRBRRGBBBRBRBBBG
BRGGBBBRGBBRBBBBBGRGBR
RRGRRGRGBGRGGBRGBGRBGB
BRBBRRRBBBGBGRBBRGGBGB
GGBBGRRBRGGGBGBBBGBBBB
BBBGBRRBRBBGBBRRBGRGBB
RGBGGBGRRGRGRGRBRBRBRG
BBRRBBBBGGBGGBBRBGRRRR
RGBBBBRRGGGRBBBRBRBRGB
BGGRRRRBBBRGBRBGRG...

output:

L

result:

ok single line: 'L'

Test #45:

score: 0
Accepted
time: 160ms
memory: 43308kb

input:

25 22
GRBBRBRBBGGBRGBBGGBRBB
RBRBBBRBBGBBRBRGBRGRGG
GRGBGRGBGGBBBGBRGBGBRB
GRBBRBGBGBRGGGGGRGBGGR
BRBRRRRGBRBGRGGBBBGRRB
GRRBBGBGGRGBRRGBGGGRBG
GRBGBGRGRBRBGBGGBRGRBR
RRRBBBRBBRRBRBBGBBRGRB
GGBRGRGRBBRRRGRBBGRRGB
BGBGGBGRRBRRRRBGRRBRRR
BRBBBRGGBGBRRBBGGGGGRB
GBGRGGGGRGRBBBRBRGBGGG
GRRGRGBRGGRBGGGBRR...

output:

W

result:

ok single line: 'W'

Test #46:

score: 0
Accepted
time: 134ms
memory: 43104kb

input:

25 22
BBGGBBBBRGBGGRBRGRRRRG
BBRGGBGGBGGBRRGBRBRRRB
BGBGBGRBBBRRGBGBBBRBBB
BBBGBBGRGGBRGBBRRBBGRG
GRRRBRBGBGBGRBBRRGBGGR
GRRBRRRRRBRRGBGGRGBGGB
GGBGGBGRRRRGGGBRGRGGBB
BBGGBGRBRBGBGRGGGRRBGG
BGBBGBRGRBGRBBRGRGBGBR
BGBGRRGBGGGBBGBBGRRBGB
RRRBBBBBGGGGGBGGBRBRRB
GGGBBRRBGRBGBBBBGBRBRR
GGBGRRRRRRBRRBGRGB...

output:

L

result:

ok single line: 'L'

Test #47:

score: 0
Accepted
time: 146ms
memory: 43304kb

input:

25 22
RGRRBRBBRRRRBRGGRBRBBR
RBBRRRGGRBBBRGGRGBRRGR
BGBGGGBGGRGBGRRRBRBRGR
BGBBGGGBGGBBRRRGRRBGGB
GBRGBRBRRRBBGRBRBRGBRR
GRGGRGBBRGBRGRRBBRBBRG
GRBRGBBRRGRBBRGRRGRBBB
RBGGRBRBRRRBRRBBBRRGBR
GBGGBRRBGGGGGRBRBGGGGG
RBGRBBBRRGGGBBBBRRGBRG
BBBBRRRGRRBGBGGBBRBGBR
GRRBGGRGGRRRRBBBBRBGRG
GGGGRRRBRRBRRBRGRR...

output:

W

result:

ok single line: 'W'

Test #48:

score: 0
Accepted
time: 185ms
memory: 45476kb

input:

24 25
BRRGRGRGGGRRBGRGGGGBGBGGG
RGBRGGGGBGGGGRBBBBBRGGRGB
GRRRBBBGRBRRBRGRGRGGGRBRR
GRBRRBBRGBBBBGRBBBRGBRGRB
RBRRRBGGGRRBBGBRBGRRBGBRG
GRRRBGBBBRGGGGRGRGGBGGBBB
BBBRRBRBRBGGRGBBGGRBGRBGG
RRBGRGRBRRGGRRRBBGBGRGGBG
RGBBBRBGRBGRRGRGBRRGGGGGB
BBRGRBGGGGRGGBRRRGGGGBBBR
GBRRGGGRRGGBGRRRBRBBBGRRG
GGRGBGGG...

output:

L

result:

ok single line: 'L'

Test #49:

score: 0
Accepted
time: 184ms
memory: 43948kb

input:

24 25
BRRRBBRRBGGRBBRGBBBRBGBGG
RGRBGGGRRGGBBBRRRRBGGBRRR
RRBGBBGRRGRBGRGGBRRBRBBRB
RRGGGGGBBGBRRBBGGRBBBGBGG
GRBGGBBBGBBBRBRGGGBRBGBBG
RRBBBBRGGRGRRGBRRRRBRBRBB
GRRRGRGGRGBBRGRBBGBRRBGRG
RRBGGRBRRRRBBGBRGRRGGGBBB
GGBRRGBBBRBBGRRGRBRGGGRGR
BRGBRGRGBBRRBRBRRGRGGRGRR
RBGBGGGBGGBRGRRRRRGRGGRBB
RGGGRRRR...

output:

W

result:

ok single line: 'W'

Test #50:

score: 0
Accepted
time: 182ms
memory: 43600kb

input:

24 25
BRBRBGGGGGGBBGGBRGRGGGBGG
RRBRGRGBRRGBGRBRGBBGGRRGR
RRRGGRRBRBGGRGGRRGGBRGRBR
GRBGBBRGGBRRGGGRRGRGGBBBG
GGBRRBRRRGRRRRBGBGGBBGGGG
RRRGRBGGBGGGBRBGGBRGBRRRR
RBGBBBBBBRGRBRRGBGBRGBGGR
BRRGRGGRGRGBBRBRBGRGBRRRG
BRGBRBGGBBGBRGBRRBGRBGRBB
BRBRBGRRGGBGBBGRGBRBGRGRG
GGRGGBRRBBGRRRRBRBGBBBBGR
RBRRBGGR...

output:

L

result:

ok single line: 'L'

Test #51:

score: 0
Accepted
time: 186ms
memory: 44300kb

input:

24 25
BGRBGBRBBBBGBBRGGBGBRRBBB
BGBGGRBRBRBGRGRRRBBGRBBRG
BBRGGRRBBBRBGRGGRBBBBGGGB
BGBRRGGGGBBRGGRBGBBGGBGGG
RRRBGGGGBRGRGRRGRBGBBRGBG
GGGBBRGBBGBGGRRRGBRRGGBRR
GRGRBBBBGBBBBRBGBRRGGGBBB
RRRBGGBGBBBGRGRRRGGGRBGBG
BBBGGRGRBGGBBGGGBGGRRBBBG
GBGRRRBGRGBRBRBGRGBBGBRGB
RGGRBRRRRBGGRBGBBBBRBBGBB
GGBGGBRR...

output:

W

result:

ok single line: 'W'

Test #52:

score: 0
Accepted
time: 204ms
memory: 45752kb

input:

25 25
BGBGBGBRBBBRBBRBGBBBRGBRG
RGGRBRBBGBGRRGGGBRBRBGGGR
RBGRGRGBRGGRBRGRRRBBGBGRR
GBRBGGGBBRGBBRRBRGBRRGBGG
BGBGRBGRBRRGGRRGBBGBGRRGG
RGRBRRRRBGRRRBRRRGRBBRGBB
GGBRRBGRGBRBRBRBGBGRBGBGG
RBRBBBGGBRBRBRBRBBGRRRBRB
RRGGRRRRBRBGRRBRBBGRBRBBR
BGGRBGBGBBGRGGRGRBRGBGRRR
RRBGGRBRGGGGBGRGGRBRRRBRG
BRRBGRRB...

output:

L

result:

ok single line: 'L'

Test #53:

score: 0
Accepted
time: 205ms
memory: 45912kb

input:

25 25
BGGBBRBGGRBGRGRGGRRRBRRRG
RRGBBRRGBBRGRBRGRGGBGBBRB
BRBGBGGRRBBGBBRRRBRRRGBGG
RRBGRRGBBBRGGGBRRBRBRGGBG
RBGBBRRBBRGGGBGGRBRGBRBBR
RGRRRBGRBGGGBBBGRRRBRBGRB
GBRRRGGRGBRBRGGRRGBBRGGGB
GRGBGGRGBBGBGGBGRBGBRRRBB
RRBBRBGGBRRBGRRBGBGBGRGRG
RRBGGGBBGRBRRBBRBGRRGRRGG
BRBBRGGRRRBRBRBRGBBBRGGGG
RGRGBGBR...

output:

W

result:

ok single line: 'W'

Test #54:

score: 0
Accepted
time: 196ms
memory: 45536kb

input:

25 25
RGGRBGRRRGRGRRBBBRRRRRRBR
GRBRBBGGBRBBRGGRBGRBBBGRB
RRRRGGRBRRGBGBGRBBBBGGRBR
RGBBBGGGRBBRBGRRGRGRGRGGB
BBRBGGGBBGBGRGBRRRGGRBRRR
GGBBGRBRBBBGGGRGGGBRRBRBG
BRGGRGGBGRGRBBBRBGGBGRGBR
GRBGGRRBBRRGBBRRBRRBGRRBR
RRBGRGBGRBGGGBBRRRBGBRRBG
GGRBGBRBGRRGGGBBBBRGBRRRR
BBRGRBRRBBRRBBRGGRBRBBRRB
BGRRRRGB...

output:

L

result:

ok single line: 'L'

Test #55:

score: 0
Accepted
time: 202ms
memory: 45740kb

input:

25 25
BGBRGRGBBRRBRGRGRBBRGBGBG
BGBGRBGGBBBGGRGRRRBBRBRGR
GGGGBRGRBGBGBGGRRRGBBBBRG
GGRBGRBGRBRBBGGGGRBGRGGBR
RGBBGGBBRGGBRBBGGBGRRGRRB
RBBGBGRRGBBBGRRGRBBBGRBGG
RRRRGGGGRBGRRGBGGRBRBBRRB
BRGRRBBBBBBGRGBRGGRRBBGRG
BBRRGGGGBBGBBGBBBGBRBBRGG
GBGGGGGBRGGBRGRBGRBRRGRRB
RBGRRGBRRGBGGBGRGRGBRBGBR
RGGGRBBG...

output:

W

result:

ok single line: 'W'