QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#473266#8599. Кольорова таблицяQwerty1232#49 1ms3844kbC++231.7kb2024-07-11 23:56:172024-07-11 23:56:18

Judging History

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

  • [2024-07-11 23:56:18]
  • 评测
  • 测评结果:49
  • 用时:1ms
  • 内存:3844kb
  • [2024-07-11 23:56:17]
  • 提交

answer

#include <bits/stdc++.h>

int32_t main() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(nullptr);

    int n, m, c, q;
    std::cin >> n >> m >> c >> q;
    std::vector<std::string> input(n);
    for (auto& i : input) {
        std::cin >> i;
    }

    auto select = [&](int s, int i, int j) -> char {
        return "RGGBRB"[s / 2 * 2 + (s + i + j & 1)];
    };
    int suc = -1;
    for (int s = 0; s < 6; s++) {
        int cnt = 0;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                cnt += input[i][j] != select(s, i, j);
            }
        }
        if (cnt <= q) {
            suc = s;
            break;
        }
    }

    if (suc == -1 || 1) {
        std::vector<int> fuck;
        for (int i = 0; i < n; i++) {
            for (int j = 0; j < m; j++) {
                fuck.clear();
                if (i > 0) {
                    fuck.push_back(input[i - 1][j]);
                }
                if (j > 0) {
                    fuck.push_back(input[i][j - 1]);
                }
                std::string s = "RGB";
                for (char ch : fuck) {
                    std::erase(s, ch);
                }
                if (!std::count(s.begin(), s.end(), input[i][j])) {
                    input[i][j] = s.front();
                }
                std::cout << input[i][j];
            }
            std::cout << "\n";
        }
        return 0;
    }

    for (int i = 0; i < n; i++) {
        for (int j = 0; j < m; j++) {
            std::cout << select(suc, i, j);
        }
        std::cout << std::endl;
    }

    return 0;
}

详细

Subtask #1:

score: 0
Wrong Answer

Test #1:

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

input:

1 34
3 17
GGGRBGGBBGGBGBGBBRGGGRRRBBGGGBBRGB

output:

GRGRBGRBRGRBGBGBRGRGRGRGBRGRGBRGRB

result:

ok ok

Test #2:

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

input:

1 75
3 37
RBRBBBGGRGBGRBBGGRGBGGGGBRBRRGRGRBBRRRGBGGRBRRRRGBRBGGBGBRBBRRRRGRGBBRRBRBG

output:

RBRBRBGRGRBGRBRGRGRBGRGRBRBRGRGRGBRGRGRBGRGBRGRGRBRBGRBGBRBRGRGRGRGBRGRBRBG

result:

ok ok

Test #3:

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

input:

1 23
3 11
GGRRRRBGGRRBGGBGRRBRGRR

output:

GRGRGRBGRGRBGRBGRGBRGRG

result:

ok ok

Test #4:

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

input:

1 75
3 37
RGBGRRRRBRGBRBGRBRRRGRBBRRGBRBBRRGBBRRBRGGBBRRRGGRRBBGBGBRGRBRGRRGRBBGGGRBB

output:

RGBGRGRGBRGBRBGRBRGRGRBRGRGBRBRGRGBRGRBRGRBRGRGRGRGBRGBGBRGRBRGRGRGBRGRGRBR

result:

ok ok

Test #5:

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

input:

1 16
3 8
GRGRGBGBRRBRGBBG

output:

GRGRGBGBRGBRGBRG

result:

ok ok

Test #6:

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

input:

1 60
3 30
BBBGRBBBGBBBRBRGBRGRBRBBRBGGGGRRRGBRGRRGGGRBRRGRBRGRBRGRGBGB

output:

BRBGRBRBGBRBRBRGBRGRBRBRGBGRGRGRGRBRGRGRGRGBRGRGBRGRBRGRGBGB

result:

ok ok

Test #7:

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

input:

1 1
3 0
G

output:

G

result:

ok ok

Test #8:

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

input:

1 49
3 24
RBRGBBGRBRBRRBBRRBBGBGGRGBBBGGBGGRRRBGGRGRRRRBGGR

output:

RBRGBRGRBRBRGBRGRBRGBGRGRBRBGRBGRGRGBGRGRGRGRBGRG

result:

ok ok

Test #9:

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

input:

1 1
3 0
B

output:

B

result:

ok ok

Test #10:

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

input:

1 86
3 43
RRGGGGGRGRBBGBBBGGBRRGBGRRBGRBRBGGBRGGGBBBRGGBBBBBRGGGBGRRRRRBGRGGGBRRBGBRBRRGBGRGRGGG

output:

RGRGRGRGRGBRGBRBGRBRGRBGRGBGRBRBGRBRGRGBRBRGRBRBRBRGRGBGRGRGRBGRGRGBRGBGBRBRGRBGRGRGRG

result:

ok ok

Test #11:

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

input:

1 35
3 17
BGBGGRBBBBRGGRRRRRRGGRGBBGGBRGGBRGG

output:

BGBGRGBRBRGRGRGRGRGRGRGBRGRBRGRBRGR

result:

ok ok

Test #12:

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

input:

1 75
3 37
GRGBGRRGRBGRGGRGBGRBRRBGGBRGRBGGGGRBBBBRRGBRGRGGBBGBRRRGRBGGGRGBGRBBGRRRGBR

output:

GRGBGRGRGBGRGRGRBGRBRGBGRBRGRBGRGRGBRBRGRGBRGRGRBRGBRGRGRBGRGRGBGRBRGRGRGBR

result:

ok ok

Test #13:

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

input:

1 20
3 10
RGRRRGBGBGRGGGGBGGGB

output:

RGRGRGBGBGRGRGRBGRGB

result:

ok ok

Test #14:

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

input:

1 60
3 30
GRRBGBBRRBBRRRBRRBBBRRRGRGBBRBBBGBGGBRGGRRRGGBRRGGGBGRGGRGRG

output:

GRGBGBRGRBRGRGBRGBRBRGRGRGBRGBRBGBGRBRGRGRGRGBRGRGRBGRGRGRGR

result:

ok ok

Test #15:

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

input:

1 4
3 2
RGBB

output:

RGBR

result:

ok ok

Test #16:

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

input:

1 61
3 30
GRGGBRGBRGRRRGBRRRBRGGBBBGBGRBGBBBBRGGRBBBRGGRRGGBBBRRGGGRGRG

output:

GRGRBRGBRGRGRGBRGRBRGRBRBGBGRBGBRBRGRGRBRBRGRGRGRBRBRGRGRGRGR

result:

ok ok

Test #17:

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

input:

1 1
3 0
R

output:

R

result:

ok ok

Test #18:

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

input:

1 45
3 22
GBGRRRRBRRGRGGGRBGGBGBBGRRGRRRRRRGGGGBRRBBGBG

output:

GBGRGRGBRGRGRGRGBGRBGBRGRGRGRGRGRGRGRBRGBRGBG

result:

ok ok

Test #19:

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

input:

1 86
3 43
GGGBGGGRRRGBRGGBGGBGGRGRRGRRBBBBGGGBBGRGRRRBBBGRBGRRGBGRBBBRBBGBBGBBBRBRRBGBGRBBGBGBRR

output:

GRGBGRGRGRGBRGRBGRBGRGRGRGRGBRBRGRGBRGRGRGRBRBGRBGRGRBGRBRBRBRGBRGBRBRBRGBGBGRBRGBGBRG

result:

ok ok

Test #20:

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

input:

1 68
3 34
GGRGBRGRRBGRRGGBGRGGGRBRGBBBBGBRGBGRRRGGGRBRBBRGBRRBRRGRGRBRGBRBGBBR

output:

GRGRBRGRGBGRGRGBGRGRGRBRGBRBRGBRGBGRGRGRGRBRBRGRBRGBRGRGRGBRGBRBGBRG

result:

ok ok

Test #21:

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

input:

1 17
3 8
RGRGRBBRGRGRRGBBG

output:

RGRGRBRGRGRGRGBRG

result:

ok ok

Test #22:

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

input:

1 61
3 30
RRBRRBGRRBBRGGBBGRGRBRRRRBRGGBRGBRGBRGBBGGGBRRRBRBGBRBGGRBRRR

output:

RGBRGBGRGBRGRGBRGRGRBRGRGBRGRBRGBRGBRGBRGRGBRGRBRBGBRBGRGBRGR

result:

ok ok

Test #23:

score: -7
Wrong Answer
time: 0ms
memory: 3612kb

input:

1 5
3 2
RRGBB

output:

RGRBR

result:

wrong answer can change at most Q positions

Subtask #2:

score: 0
Wrong Answer

Test #31:

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

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

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

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

score: -7
Wrong Answer
time: 0ms
memory: 3828kb

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

wrong answer can change at most Q positions

Subtask #3:

score: 3
Accepted

Test #61:

score: 3
Accepted
time: 1ms
memory: 3548kb

input:

79 100
3 7900
RRRRBBGGGRGRGRGRGGGGRBBRRRGBRGRGRBBRGGBRRBBRGRGRBBBRGRBBRBBBRGGBGGRBGBBGGGBRGBRRGBBBGGGGRGGGRGRGBBGG
RGBRBGGGGGRBGRGBGGBGRBRBBRBBRRGRGGGBRRBRGRGBBBBRGGGGBGGRGGGGRRBRGRRGGRRBGBGBBGRRGBRBRBBGGRGBRGBRRBRR
RBRRGGBGRRGRGGRRRBGGBRR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RRBRRBGGBGRBB...

output:

BRBRBRGRBRBRGRBGBRGRBRGRGRGBRGBRGBRBGBRGRBRGRGRBRGRGRGRGBRGRGBRBRGRGRGBRBRGRGBRBRGRBRBRBR
RBRGRGRGRGRGRGRBGBRGRGBGRGRGBRGBRGBGRGBRBRGBGRBRBRBRGBGRGBRGRGBRGBGBGRGBGBRGRGBRGRGRBRGRG
GRBRGBGBGBGBGBGRBRGRGRGBGRGRGBRGBRGRGBGBRGRGRGRBRGRBRGRBRGBRBRGBRGBRBGRGRGBRBRGBRBRBRGRBR
RGRGRGBRBRBGBGRBRGRGRGBRBGRGRG...

result:

ok ok

Test #64:

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

input:

51 33
3 1683
GGRBGBGBGBRBRBRGBRRBBGRRRRGGBGGGB
BBGBBRRGRBGRRGGRGRBBRGGGRGGBRBRGR
RGGRGRGGBBGBBGGRBGBRBBGGRGRGRRBBG
RBGBRGRGGRRGRBGGGBBRBGGGGGGBRGBRG
RGRBGGBRGBGBRGBRBGBGGRGGRBRGRGBGG
GRBRRBGGGRBRGBBRBBBBRGRGBGRRGRBGB
RBRGGBRRBGBRRBRBRGGBBGRGGBGBBRRBG
GGGBGBGRRBGBGGGBRGBBBGRGRRRGRGBRB
GGBRBBGBGRBRRGR...

output:

GRGBGBGBGBRBRBRGBRGBRGRGRGRGBGRGB
BGRGBRBGRGBRGRGRGBRGBRGRGRGBRBGRG
RBGRGBGRBRGBRGRGBGBRGBRGRGRGBRBGR
GRBGRGRGRGRGBRGRGBRGBGBRGRGBRGRBG
RGRBGRBRGBGBRGBGBGBRGRGBRBRGBRBGR
GRBRBGRGRGBRGBRBRBRBRGRGBGBRGBRBG
RBRGRBGRBRGBRGBRGRGRBRGRGBGBRGBRB
GRGBGRBGRBRGBRGBRGBGRGRGRGRGBRGBR
RGBRBGRBGRBRGBRGBRGRBRGRGRGR...

result:

ok ok

Test #65:

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

input:

79 74
3 5846
RRGRGR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RGRBRGBGBRBRBRGRBRGBR...

result:

ok ok

Test #77:

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

input:

100 74
3 7400
BRGGBRRBGBBRRBGBGRBGGBRGGBBGRBGGGRBBGRRRBRRGGRGBGRBBBBGBRBGRGRBRRRBRGGBBBR
RRRGBRGRGBBGRRBRGBGBRBBBRBGBBGRGGBBRRGBGGBGRBBRBRRGBBGBRRGGGRGRGBGRGBGRRRR
BBRRGBGGGGGGGBBGRGRBBBGGRRBRRGRGGRGRRRBRGBGRBGBRBRBBRBRRGRRBGRRGBGGRBGGRRG
RBRGBGBGRRRBGBRRBGRRGBBBGBGGRGRRBGGGGBRBGGBBBGGGBRGRGRBBRGGBG...

output:

BRGRBRGBGBRGRBGBGRBGRBRGRBRGRBGRGRBRGRGRBRGRGRGBGRBRBRGBRBGRGRBRGRBRGRBRBR
RGRGRGRGRGBRGRBRBGRBGRBRGRGBGRBGRBRGRGBGRBRGBGRGRGRBRGBRGRBGRGRGBGRGBGRGRG
BRGRGBGRGRGBRBRGRBGRBGRGRGBRBGRBGRGRGRGRGRGRGRBRBRBRGBRGRGRBGRGRGRGRGRGRGR
RBRGBGBGRGRGBRGRBGRGRBGBGBGBRBGRBGRGRBRBRGBGBGRGRGRGRGBRGRGRBGRGBGRGBGBGRG
...

result:

ok ok

Test #78:

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

input:

28 19
3 532
RBRBGRRRRBBGBRBBBRB
GGRBRRGBRRBGRBBRRGR
GBBRGGRBGBGBRBBBBGB
GBRRBRBBRBBBBBRBRGG
BBRBBRBGGBBGRGRRGGG
RGBRBBGRGRBBRBRGRRB
GRRGGRGBGBBGBRRGRBB
RBBGRRRRGGGRRGGRRRR
RGRRBGGBBGGGRBRBGBR
BBGRRGBGGBBGRRGRGGG
RRBGBRRGRGBBGGRRBRR
RRGBBBRGRBGRRGRGBGG
BGGRBGRBGRBRRRRBBGB
BGRRBRRBBRGGRBBBGRG
RBGBBRGG...

output:

RBRBGRGRGBRG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RBRGRGBGRGRBGB
GRGBRBRBRGRGRGBGBGBRBRBRGBRGRGBGRBRGRGBGRGRGRBRBG
...

result:

ok ok

Test #90:

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

input:

54 27
3 1458
GBGRBRGGGGBGBBBRRRGBRGBRBBB
RBBBRBBGRRBBGBRGGRBRGGRBGRG
RRRGRBGGGRRBBBRBBBBBRGRBGRR
GBRGGBGBBBRRBRBGRRBRRGRBBBG
RBBRGRBBGBRBBRBRGRGBRGRGBGB
GBRBGRGGBBRBRRBBBBRBBBBBBGG
GBRBBBGGGBGGRBGBRBRRBBBBBGG
RBBBBBBGGGBBRBGBGGBBBBBGGRG
BGGBGGRBBGRBBGRGGGGBBRGBRBG
RBGGBGRGGGBBRGBGRRRRRBGRGGB
BGRGGGR...

output:

GBGRBRGRGRBGBRBRGRGBRGBRBRB
RGBGRBRGRGRBGBRGRGBRGRGBGBG
GRGRGRGRGRGRBRGBGBRBRGRGRGR
RBRGRBRBRBRGRGBGRGBRGRGBGBG
GRBRGRBRGRGBGRGRGRGBRGRGBGB
RBRBRGRGBGRGRGBGBGRGBRBRGRG
GRGRBRGRGBGRGBGBRBGRGBRBRGR
RBRBRBRGRGBGRGRGBGBGBRBGBRG
BGBRGRGBGRGBGRGRGRGBRGRBRBR
RBGBRGRGRGBRBGBGRGRGBRGRGRB
BGRGBRGBGBGBRBRBGBGR...

result:

ok ok

Subtask #4:

score: 7
Accepted

Test #91:

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

input:

8 69
3 276
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGR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time: 0ms
memory: 3620kb

input:

4 5
3 10
RGRBG
RGRBG
RGRBG
RGRBG

output:

RGRBG
GRGRB
RGRBG
GRGRB

result:

ok ok

Test #94:

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

input:

32 49
3 784
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBR...

output:

GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
RGRGRGRGRGRGRGRGBRBGRGRGRGBRGRGRBGRGRGRGRGBRGBRBR
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
RGRGRGRGRGRGRGRGBRBGRGRGRGBRGRGRBGRGRGRGRGBRGBRBR
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
RGRGRGRGRGRGRGRGBRBGRGRGRGBRGRGRBGRGRGRGRGBRGBRBR
...

result:

ok ok

Test #95:

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

input:

52 94
3 2444
RGRGRBRGBRBRGRBGRGBRBRBGBRBRGRGRBRGRBRBRBGRGBGBRGRGRGBGBRGRGBGRBGBRGRBRGBGBGRBGBGBRBRGRGRGRGRB
RGRGRBRGBRBRGRBGRGBRBRBGBRBRGRGRBRGRBRBRBGRGBGBRGRGRGBGBRGRGBGRBGBRGRBRGBGBGRBGBGBRBRGRGRGRGRB
RGRGRBRGBRBRGRBGRGBRBRBGBRBRGRGRBRGRBRBRBGRGBGBRGRGRGBGBRG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RGRGBGRGBRBRBRGRGRBGRB...

output:

GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
RGRGRGBRGRGRGRGBRGRGRGRGRBGRBGRGRGRGRBGRGRGRGRGRGBRGRGRBRBRGRGRG
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
RGRGRGBRGRGRGRGBRGRGRGRGRBGRBGRGRGRGRBGRGRGRGRGRGBRGRGRBRBRGRGRG
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRG...

result:

ok ok

Test #108:

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

input:

51 13
3 331
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRBGBGRB
BGRGBGRB...

output:

BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGRGRBRBGR
BGRGBGRBGBGRB
RBGRGR...

result:

ok ok

Test #109:

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

input:

75 57
3 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GR...

output:

BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
RGRBRBRGRGRGRGRGRGRGRBRGRGBRGRGRGRGRBGRGRBGRGRGRGR
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
RGRBRBRGRGRGRGRGRGRGRBRGRGBRGRGRGRGRBGRGRBGRGRGRGR
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
RGRBRBRGRGRGRGRGRGRGRBRGRGBRGRGRGRGRBGRGRBGRG...

result:

ok ok

Test #112:

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

input:

51 90
3 2295
GBGBRGRGBGRBGRBGBGBGBRBRBRBRGRGRBGBRBRGBGRGBGBRBGRBRBRBRGRGBGBRBRGBRBGBGBRBRGRBRGBRBGBRGRB
GBGBRGRGBGRBGRBGBGBGBRBRBRBRGRGRBGBRBRGBGRGBGBRBGRBRBRBRGRGBGBRBRGBRBGBGBRBRGRBRGBRBGBRGRB
GBGBRGRGBGRBGRBGBGBGBRBRBRBRGRGRBGBRBRGBGRGBGBRBGRBRBRBRGRGBGBRBRGBRBGBGBRBRGRBRGBRBGBRGRB
GBGBRGRGBGRBGR...

output:

GBGBRGRGBGRBGRBGBGBGBRBRBRBRGRGRBGBRBRGBGRGBGBRBGRBRBRBRGRGBGBRBRGBRBGBGBRBRGRBRGBRBGBRGRB
RGRGBRGRGRGRBGRBRBRBRGRGRGRGRGRGRBRGRGRGRGRGRGBRBGRGRGRGRGRGRGBRGRGBRBRBRGRGRGRGRGBRBRGRGR
GBGBRGRGBGRBGRBGBGBGBRBRBRBRGRGRBGBRBRGBGRGBGBRBGRBRBRBRGRGBGBRBRGBRBGBGBRBRGRBRGBRBGBRGRB
RGRGBRGRGRGRBGRBRBRBRGRGRGR...

result:

ok ok

Test #113:

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

input:

41 73
3 1496
BGRGBGBRGBRGBGRGB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RGGRGBGBBB...

output:

GRGBGBRGRGBRGRGBRGRGRGBGBRBRGBRGBRBGRBGRGRBRGBGRGRG
RGRGRGBRGRGBRGRGBRGRGRGRGBRGRGBRGBRBGRBGRGRGRGRGRGR
GRGBGBRGRGBRGRGBRGRGRGBGBRBRGBRGBRBGRBGRGRBRGBGRGRG
RGRGRGBRGRGBRGRGBRGRGRGRGBRGRGBRGBRBGRBGRGRGRGRGRGR
GRGBGBRGRGBRGRGBRGRGRGBGBRBRGBRGBRBGRBGRGRBRGBGRGRG
RGRGRGBRGRGBRGRGBRGRGRGRGBRGRGBRGBRBGRBG...

result:

ok ok

Test #131:

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

input:

84 96
3 4032
RGBBBRRBRRRBBBGGRBRBBRGGRRBBBGRBRBRGGGGRGBRBRRGBRBBBGBGGBRGGRBRGGBRRBGRRGGBGGBGBBRBRGRGRGGRRGRBB
RGBBBRRBRRRBBBGGRBRBBRGGRRBBBGRBRBRGGGGRGBRBRRGBRBBBGBGGBRGGRBRGGBRRBGRRGGBGGBGBBRBRGRGRGGRRGRBB
RGBBBRRBRRRBBBGGRBRBBRGGRRBBBGRBRBRGGGGRGBRBRRGBRBBBGBGGBRGGRBRGGBRRBGRRGGBGGBGBBRBRGRGRGGRRG...

output:

RGBRBRGBRGRBRBGRGBRBRGRGRGBRBGRBRBRGRGRGRBRBRGRBRBRBGBGRBRGRGBRGRBRGBGRGRGBGRBGBRGBRGRGRGRGRGRBR
GRGBRGRGBRGRBRBGRGBRBRGRGRGBRBGRGRGRGRGRGRGRGRGRGRBRBRBGRGRGRGBRGRGRGRGRGRGRGRBRBRGBRGRGRGRGRGRB
RGBRBRGBRGRBRBGRGBRBRGRGRGBRBGRBRBRGRGRGRBRBRGRBRBRBGBGRBRGRGBRGRBRGBGRGRGBGRBGBRGBRGRGRGRGRGRBR
GRGBRGRGB...

result:

ok ok

Test #132:

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

input:

8 36
3 144
BRRGGRRBBB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BGRRGGRRGG
BG...

output:

BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBGRGRGRGR
BGRGRGRGRG
RBG...

result:

ok ok

Test #139:

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

input:

84 63
3 2646
BRRBGBGBGBGGRRBBRGBGBGBRGRGRBRBBBRBBBBBGBRRGRBBRGRGBGBRRRBRRBGG
BRRBGBGBGBGGRRBBRGBGBGBRGRGRBRBBBRBBBBBGBRRGRBBRGRGBGBRRRBRRBGG
BRRBGBGBGBGGRRBBRGBGBGBRGRGRBRBBBRBBBBBGBRRGRBBRGRGBGBRRRBRRBGG
BRRBGBGBGBGGRRBBRGBGBGBRGRGRBRBBBRBBBBBGBRRGRBBRGRGBGBRRRBRRBGG
BRRBGBGBGBGGRRBBRGBGBGBRGRGRBRB...

output:

BRGBGBGBGBGRGRBRGRBGBGBRGRGRBRBRBRBRBRBGBRGRGBRGRGRBGBRGRBRGBGR
RGRGRGRGRGRGRGRBRGRBRBRGRGRGRGRBRGRBRBRBRGRGRGBRGRGRBRGRGRGRGRG
BRGBGBGBGBGRGRBRGRBGBGBRGRGRBRBRBRBRBRBGBRGRGBRGRGRBGBRGRBRGBGR
RGRGRGRGRGRGRGRBRGRBRBRGRGRGRGRBRGRBRBRBRGRGRGBRGRGRBRGRGRGRGRG
BRGBGBGBGBGRGRBRGRBGBGBRGRGRBRBRBRBRBRBGBRGR...

result:

ok ok

Test #140:

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

input:

74 37
3 1369
BRBRGG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GRGRBRB
RGBRGRGRGBRGBRGRBRGRGRGRBGRGRGRBRBRBG
GRGBRGRGRGBRGBRGRBRGRGRGRBGRGRGRGR...

result:

ok ok

Test #150:

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

input:

93 27
3 1255
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBB...

output:

RGRBRBRGBGRBRGRBRGRGRGRBRBG
GRGRGRBRGRGRBRGRBRGRGRGRGRB
RGRBRBRGBGRBRGRBRGRGRGRBRBG
GRGRGRBRGRGRBRGRBRGRGRGRGRB
RGRBRBRGBGRBRGRBRGRGRGRBRBG
GRGRGRBRGRGRBRGRBRGRGRGRGRB
RGRBRBRGBGRBRGRBRGRGRGRBRBG
GRGRGRBRGRGRBRGRBRGRGRGRGRB
RGRBRBRGBGRBRGRBRGRGRGRBRBG
GRGRGRBRGRGRBRGRBRGRGRGRGRB
RGRBRBRGBGRBRGRBRGRG...

result:

ok ok

Subtask #6:

score: 13
Accepted

Test #151:

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

input:

4 10
3 26
BGGRRBBRBG
BGBGGBGRRB
RBBBBBRGGR
RGRBGGRGBB

output:

BGRGRBRGBG
RBGRGRGRGB
GRBGBGRGRG
RGRBGRGRBR

result:

ok ok

Test #152:

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

input:

32 55
3 1173
GBBBGBRRBGBGRGRGBRGBRRGGBGRGBRBRGRGGGGGRGGGGGGGGBRBRRGR
BRRRRBBBBGBBGGRRRBGBBGGGBGGG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RGBGBGRGBGRGBRBG
GBGB...

result:

ok ok

Test #157:

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

input:

60 81
3 3240
BGRBBGBGRBRBBBBBRGRGGRRGGRGGRGBGGRGGBGBBBRBRBRBGGBGGGGRGBGBBBRRGGRGBBGGBRRGRRRBBG
RRRBRRRGBGRRBRBBBRBGGRBRRGRRGGGRGRRBGBBGRRGBRBBBRBRGBBGGGBGRBBRRRRBGGBRBBBBGRBRBG
BRBGGRGRGGBBBRRBGGBBBRRGGGRGGGGGRRBGRBGRRBBRBBGGGRRBGGGGRRGBRGRBGRRRBBGRBBBGRRGBR
BRRBBBGRBRGBBBGGRGBRGGRRBGGGBBGGGRRGBBGRR...

output:

BGRBRGBGRBRBRBRBRGRGRGRGRGRGRGBGRGRGBGBRBRBRBRBGRBGRGRGRBGBRBRGRGRGBRGRBRGRGRGBRG
RBGRGRGRBGBRBRBRBRBRGRBRGRGRGRGRGRGBGBRGRGRBRBRBGRBGBGRGRBGBRBRGRGBGBRGRBRBRGBRBR
BRBGRGRGRBRBRGRBGBRBRGRGRGRGRGRGRGBGRGBRGBGRBRGRBGRBGRGRGRBRGRGBGRGRGBRGRBRGRGBRG
RGRBGBGRBRGRBRGRBGBRGRGRBRGRBRGRGRGRBRGBRGRGRGBGRBGRBG...

result:

ok ok

Test #158:

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

input:

80 25
3 1333
BGBGGBRBGBGRGBRRGRBBRBBGG
GRRRRRRGGRRGBBGRBRGGGRRGR
RBGBBRRRGGRGBGRRRGGGRGRBB
GGRRGRRGBBBRRRBRBRGBGGGBG
RRRGGGBRBRGGGRRGRRRBGGGGG
RGBGRRGGRGRBGBBBRBBBGRGRG
RGGGRBBRGRBRBGGRRRRGRGRGG
BGGRBGRGRRRRGBBBRGGRGBRBG
RGBRGRRBRRGBRGBBGGGRGRRRB
GGGRGRBGRGGGGRRBGGRRGGGBB
GBRRRRBGGGBRBGRBGBBRGGRBB
G...

output:

BGBGRBRBGBG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GRGRBRGBGRGRGRGRBRGRGRGBRBGRGRBGB...

result:

ok ok

Test #170:

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

input:

64 57
3 2432
RGGRGGRRGGBRGRGRBGBRBBGBGBBRBRRRBBGBGGGGGRRRRGBBBRGRRBBBR
BGGRBRBRRBBBBBRGRGRRRRRRBBRRBRBGBBBBRRGBGRGRRRBGGRBRGRRBR
RRBGBRGGRGGRRBBGGBRRGGBRRGGBBBRRRBGRBGBBGBRGBGRBRGBRBGGGR
GGRGGBGGBRBRGRBRRBRGRGGBGRGBRRGGRRBRBGGRBGGRRRGRRGBGGBBBG
GBBBRBGGRBGGRBRBBBBGRRGGBRBBBGBGGRBRGGGBRGGBGRRGGGRGRRG...

output:

RGRGRGRGRGBRGRGRBGBRBRGBGBRGBRGRBRGBGRGRGRGRGRBRBRGRGBRBR
BRGRBRBRGBRBRBRGRBRGRGRGBRGRGBRGRBRGRGRBRGRGRGRGRGBGRGBRG
RGBGRGRGRGBRGRBRGRGRGRBRGBRBRGBRGRGRBRBRGBGRBRGBGRGRBRGBR
GRGRGBGRBRGBRGRGRBRGRGRBRGBRGRGBRGBGRGRGBGRGRGRGRGBGRBRGB
RBRBRGRGRBRGBRGBGRBRGRGRBRGBRGBGBRGRGRGBRBGBGRGRGRGRGRGRG
GRBRBRGRBG...

result:

ok ok

Test #171:

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

input:

84 5
3 280
RBRRB
GRBBG
GGRGB
GGRRR
BGBGR
BBRBG
BGGBG
GGRBG
BGRBB
BBBBG
BRBBG
GBBRR
GGGBB
RBBGR
BRBRB
GGRBR
GRRGG
GRBBG
BBGRB
BGBBR
RRBRG
GGRGR
BGBGG
BRBRG
BRGGG
GGRGG
BRGRG
GRBRG
GRGBG
GBRBR
RRBBG
BBGBB
RRRGB
BBBRB
BGBRR
GGBBR
BBBBB
BRRBG
BGGBG
GBRGB
BRGGR
BRRGG
BRRBR
BRBGR
BGBRR
GBRRB
BRRGR
GBGRR
B...

output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Test #181:

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

input:

4 52
3 104
GRRGGGGBGRRBRGBRGRGRRBGBGBBRGGRRBBGBGBGBGGBRRRRBRRRG
RGBGGGRGBGRBGRRBBBBRGRRBBBBGGBRGRBBRGGRBRGBRBGRBBGGR
RBRGBGBGGRBBGGGRRRRBBRGRRGGBRGGRGRRGBRRRGRRBRGRGRBGG
GRBBRRRRGGBRBBBGBBGGBRRGRGGBGGBRRGBRBBRRBGGBGBBBRRRR

output:

GRGRGRGBGRGBRGBRGRGRGBGBGBRGRGRGBRGBGBGBGRBRGRGBRGRG
RGBGRGRGBGRGBRGBRBRGRGRGBRBRGBGRGBRGRGRGRGRGBGRGBRGR
GBRBGRBRGRBRGBRGBRGBGRGRGBGBRGRGRGBRBRGRGRGBRBGRGBRG
RGBRBGRGRGRGBRBRGBRGBGRGRGRGBRBRGRGBRBRGBGRGBRBGRGBR

result:

ok ok

Test #182:

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

input:

3 4
3 6
RRRR
GBGR
RRGB

output:

RGRG
GBGR
RGRB

result:

ok ok

Test #183:

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

input:

1 48
3 24
BBGBBRRGGBBRRGRBBBBBRRGBGBRRGGBGRGBBBRRRRRRRGRGB

output:

BRGBRGRGRBRGRGRBRBRBRGRBGBRGRGBGRGBRBRGRGRGRGRGB

result:

ok ok

Test #184:

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

input:

4 93
3 186
RRBRRBGRBBGGGGGGBRGGRBRGGRBRGRBGBRGGRRGGBBRRBBRGGRRBGRGGBRRRBGRBGBGBBRRBBBRBBGBGBBBRBGBBRGGBB
RBRRRBGBRBRGGRRGBGRGBBBBGGBRGBGGGGGBRBRRGGBRRBBGRBBGBGGGGGRBBGBGGBGGRRBBBBRGRGGBRBRRRGGRGRGRB
BGBGGBRGGBGGBRGRGGBBGBGRGRGRGBBGBBRGBRBBRRGBGRGGBRRGGRRGBGGGRRGGRBGGBRBGBBBGBBGRRBBRBRRRRGRRG
BBBGBGB...

output:

RGBRGBGRBRGRGRGRBRGRGBRGRGBRGRBGBRGRGRGRBRGRBRGRGRGBGRGRBRGRBGRBGBGBRGRBRBRBRGBGBRBRBGBRGRGBR
GBRGRGRBRBRGRGRGRGRGBRBRGRGBRBGRGBRBRBRGRGBGRBRGRBRGBGRGRGRBRBGRBRBGBRBRBRGRGRGBRBRGRBGBRGRGB
BGBRGBGRGRGRBRGRGRBRGBGBRGRGBRBGBRGRBRBRGRGBGRGRBRGRGRGRBRGRGRBGRBGRGBRGRBRGBGRGBRBRBRBRGRGRG
RBRGBGBGRGRBRGRGRG...

result:

ok ok

Test #185:

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

input:

4 37
3 74
RGGBBRBRGGGBRGBBGBRGRRBBRGGBBGGBGGGRB
BRGRRGRGRRRRGRRBRRGRBGBRGGRGRGGGBGBRB
RBGRBRGRBBBRRBRRGGBBRBBGBBRGGRRBBGRRG
RGBBBRRBGRGRRGGBGRGGRGGRGGRBBGBGBBRGB

output:

RGRBRGBRGRGBRGBRGBRGRGBRGRGBRGRBGRGRB
BRGRGRGBRGRGBRGBRGBRBRGBRGRGBRGRBGBGR
RBRGBGRGBRBRGBRGBRGBRBRGBRGRGBRBRBRBG
GRBRGRGBGBGBRGBRGBRGBGBRGBRBRGBGBRGRB

result:

ok ok

Test #186:

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

input:

2 77
3 77
GRGRGGRRBBBBGGBRRGGBRRRRBBRBGBGBBBRGGGGBGBGBBBGRGBBBGRGGGGRRBRGGRBRRBBRBGBBRR
GGRRBRRBBBBRBBRBBBGBBGGBBGGBRRBGRRBBGRBBBRGBBBRBRBBGGGRGRGBBBBGRBGRRBRRGRGRBB

output:

GRGRGRGRBRBRGRBRGRGBRGRGBRGBGBGBRBRGRGRBGBGBRBGRGBRBGRGRGRGRBRGRGBRGBRGBGBRGR
RGRGBGRBRBRGBGRBRBRGBRGBRGRGRGBGBRBRGRBRBRBRBRBGRGBGRGRGRGBGRBRGBGBRGBRGRGBRB

result:

ok ok

Test #187:

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

input:

1 22
3 11
RRGBGBGGGBBRRBRGBRGGRG

output:

RGRBGBGRGBRGRBRGBRGRGR

result:

ok ok

Test #188:

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

input:

4 74
3 148
RRBRBBBRBGGBGBBGGBRGRGRGGGGGRGBBBRRRGBBRGGRBBBBGRGRGGBRRBRRRRRBRGGBGRRBGGB
GBBRRGRGBGRRBBBRRBGRRBGGRBBGGGRRBGBGGBGBBRGBRBGGRRGRRBRGRRGGGBBRBRGBBBBBBB
GRRBBGBGBBGBBGRRGGGGBGBGRGRBBBGBBRGRBGRRGBRGRGGRBBBGBBGBGBGRRRGRRRRRBGGBGR
GGGGRBBRGRBGGGRRGGRRRBGGBBBBRGRGBGBGRGRBGGGRBBBBGRGRRRBBRGGGBBRG...

output:

RGBRBRBRBGRBGBRGRBRGRGRGRGRGRGBRBRGRGBRGRGRBRBRGRGRGRBRGBRGRGRBRGRBGRGBGRB
GBRGRGRGRBGRBRBRGRGRGBGRGBGRGRGBRGBGRGBRBRGRGRGRGRGRGRGRGBRGRBRGBGRBGBRBGR
RGBRBRBRBRBGRGRGRGRGBGBGRGRBRBRGBRGRBRGBGBRGRGRGBGBGBGRBRGBRGRGRGRGRBGBRBG
GRGBRBRGRGRBGRGRGRGRGBGRBRBRGRGRGBRGRGRGRGBRBRBRGRGRGRBRGRGBRBRGRGRGRBRGRB

result:

ok ok

Test #189:

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

input:

4 18
3 36
BGRBBGRRBRBRBBGBGR
BBRBBGRBBBBGGBBRGB
GGRRRBRBGRGRGRBGGR
BRRRGGGBGRBRGRRGRG

output:

BGRBRGRGBRBRBRGBGR
RBGRBRGBRBRGRBRGRB
GRBGRBRGBRGRGRBRGR
BGRBGRGBGBRGRGRGRG

result:

ok ok

Test #190:

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

input:

5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BGRBGBRBRGBRGRGRBGBRGRGRGRGRBRGRBRGRBRGRBRGBG

result:

ok ok

Test #192:

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

input:

2 34
3 34
BRRBBBBBGGBBRBRGBRBGRRBGRGRGBGBRBG
BGBBRBRGRGRRRGGRGBBRGGBGRGBRRRRBRG

output:

BRGBRBRBGRBRGBRGBRBGRGBGRGRGBGBRBG
RGBRGRGRBGRGRGBRGBRBGRGRGRBRGRGBRB

result:

ok ok

Test #193:

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

input:

1 74
3 37
BBGRBRGBBBRBGBGRRRGGRRGBGRBGGGBGRGRBRBRGBBRGGBGGRRRGGRRGRGBRGBBBGRBRBRGRGB

output:

BRGRBRGBRBRBGBGRGRGRGRGBGRBGRGBGRGRBRBRGBRGRGBGRGRGRGRGRGRBRGBRBGRBRBRGRGB

result:

ok ok

Test #194:

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

input:

5 27
3 67
RGRRBRRGBBGBRGGRGBGBBBBGBBB
RGGGRBGGGRRBRRRRGRGGBRBRRBR
RGBRRGBGRRRRBBGRRRBBBBBGBGB
BRBRGGRRRGGGGRBRGBRGBGGBGGR
RGRGRBRBBRBGGBRBBGBBGGRGRBB

output:

RGRGBRGRBRGBRGRGRBGBRBRGBRB
GRGRGBRGRGRGBRGRGRBGBRBRGBR
RGBGRGBRGRGRGBRGRGRBRBRGBGB
BRGRGRGBRGRGRGBRGBGRBGBRGRG
RGRGRBRGBRBRGBRBRGBGRBRGRBR

result:

ok ok

Test #195:

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

input:

3 71
3 106
BBBBGBGRBRGBGGRBGGGBGGGRGGRGGGGBGRGGRRGBGGRRGBGBBGGBGRGGRRRRBGRRGGGRRRG
RRBBGRGGBGRBGGRBGRGGBGRBRGGGBRGBGRBGRBGBGRRRRBGBRBBGRBBBGBRGBGRGGGBGBRB
RRBGBRBBBBRBRGGRGGRBBGRRRRRGBBBBBGRRBRGGRBRBGBRBRBRGGBBBGGBBGGBRRGGGGGB

output:

BRBRGBGRBRGBGRGBGRGBGRGRGRGRGRGBGRGRGRGBGRGRGBGBRGRBGRGRGRGRBGRGRGRGRGR
RGRBRGRGRGRGRGRGRGRGBGRBRGRGBGRGRGBGRBRGRGRGRGRGBRBGRBRBRBRGRBGRGRBRBRB
GRBGBRBRBRGBGRGRGRGBRBGRGRGRGBGBGRGRBRGRGBGBGBGBRBRBGRBRGRBRGRBGRGRGRGR

result:

ok ok

Test #196:

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

input:

2 15
3 15
RRBGRBBBGGRBRBB
RRBBRRBRGGRGRRG

output:

RGBGRBRBGRGBRBR
GRGBGRBRBGRGBRG

result:

ok ok

Test #197:

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

input:

1 60
3 30
GBRBBRBBBGGRGBRGGBRRRGGBRRGGGGBRGBBGGRBGGGGRGRGGRBGRGRRRGBGG

output:

GBRBRGBRBGRGRBRGRBRGRGRBRGRGRGBRGBRGRGBGRGRGRGRGRBGRGRGRGBGR

result:

ok ok

Test #198:

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

input:

4 100
3 200
RGBBGGGBBGGRGBRBRRRRBBRGRBBRGRBRGGRRGBBBRBGRGGRBRRBGGBGBBBBRRRRBGBGGBGRRBGBBRRGGBGGBGRBBGGGRBRGRRBBB
RRGGGGGGBRBBRBRRBBRRGRRGRGGGGGBBGRGBBRGBRGRGRBGGGGBGGGBBGBGBRRGBBGRGBGGBBRRRBBGBRGGGBRGBGRGGBRBRGRGR
RGGGGRRRRGRBBGRRRRGGGBGRBGBGRBRBBGGRRRRRRGRGBRRRBBRRGBBBRBRRRGRGBRGGBRGGBBBRGRBGRBRRRB...

output:

RGBRGRGBRGRGRBRBRGRGBRGRGBRGRGBRGRGRGBRBRBGRGRGBRGBGRBGBRBRGRGRBGBGRBGRGBGBRGRGRBGRBGRBRGRGRBRGRGBRB
GRGBRGRGBRBRGRGRBRGRGBRGRGBRGRGBRGRBRGBRGRBGRBRGBRGRGRBRGRGBGRGRBGRGRBGBRBRGBGRBRBGRBGRBRGRGRGBGRGBR
RGRGBRGRGBRBRGRGRGRGRGBRBRGBRBRGBRGRGRGBRGRBGRGRGBRGRBRBRBRGRGRGRBGRBRBGBRBRGRBGBRBGRBGRGRBRBRGBGB...

result:

ok ok

Test #199:

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

input:

3 45
3 67
BGBBRBGRGRBBGBBGGRGRRBBBRBGBBBBGGBGGBBGBGRGRG
RRBRRRRGBBGBGRRGGBRGRGBGGRBBRGGBGGGGRGGBBGGGG
RRBBGGBRRRBGBGGBGGRGGGGGBRGRRBBBBBBGBBBGBBGGB

output:

BGBRGBGRGRBRGBRGRGRGRBRBRBGBRBRGRBGRBRGBGRGRG
RBRGRGRGBGRBRGBRGBGRGRBGBRBRGRGBGRBGRGRGBGRGR
GRBRGRBRGRBGBRGBRGRGRGRBRGRGRBRGBGRBGBGRGBGRB

result:

ok ok

Test #200:

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

input:

5 31
3 77
RBBRGRBBGBBGGBBRRBBBRRRBBRBGBGR
RGGRBBRBGGRBRGGBRRRGBBBBBGBRRBB
BBRRGGRGGRGBBRRRGGBGBGBRBRRRGGG
RBGGRBGBGRRRRRRRGRGBBRGRGRBBGRB
GBBGGBBGGGBBBGRBBBRGRBBBRBBGBGB

output:

RBRGRGBRGBRGRBRGRBRBRGRBRGBGBGR
GRGRBRGBRGBRGRGBGRGRBRBRBRGRGBG
BGRGRGRGBRGBRGRGRGBGRGRGRGRGRGR
RBGRGBGBGBRGBRGRGRGBGRGRGRBRGRB
GRBGRGBGRGBRGBRBRBRGRBRBRBRGBGR

result:

ok ok

Test #201:

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

input:

3 75
3 112
BRGGBGGBBBBRBRBGBGBRRBGGBRRRBRBBRGRBGBRRBRBGGBRRBBRGGRBRBGRRGRGRRRGBBBGRRBG
GGGGGBRRBGGBBGGRGBBGBRGGGGRRRGGRBGGGBRRGBBBRRRGGGBBBGBBGRBGBBRRGRBRBRGRBBGB
BBGBGGRGGGGGBGRRRGRGGGBRGRGGGRGRRGRGRBBRGGGBRGRGRRRBBGRBRGBBGGRGGRRRBRBGRGR

output:

BRGRBGRBRBRGBRBGBGBRGBGRBRGRBRBRGRGBGBRGBRBGRBRGBRGRGRBRBGRGRGRGRGRBRBGRGBG
GBRGRBGRBGBRGBGRGBRGBRBGRGRGRGRGBGRGBRGRGBRBGRGRGBRBRBRGRBGBGRGRGBGRGRBGBGB
BRGBGRBGRBGBRGRGRGBRGBRBGRGRGRGRGRGRGBRGRGBRBGRGRGBRBGBRGRBRBGRGRGRGBGRBRBR

result:

ok ok

Test #202:

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

input:

2 16
3 16
GGGRBBGBRBGBRRGR
GBRRRGRRGGRGGGGR

output:

GRGRBRGBRBGBRGRG
RBRGRGRGBGRGBRGR

result:

ok ok

Test #203:

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

input:

1 64
3 32
RRBGRRRRRBRGBGRGRBRGBRBBRGGRGGRRRRBRRRRGBRRRGBRGRRRBBGGRBRGBGRBR

output:

RGBGRGRGRBRGBGRGRBRGBRBRGRGRGRGRGRBRGRGRBRGRGBRGRGRBRGRGBRGBGRBR

result:

ok ok

Test #204:

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

input:

5 8
3 20
RGRBRRRB
BGRBRGGB
GBGGRGGR
GRBBBRRG
BBBBRBGG

output:

RGRBRGRB
BRGRGRGR
GBRGRGRG
RGBRBRGR
BRGBRBRG

result:

ok ok

Test #205:

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

input:

3 49
3 73
BGBBGBRBGBGBBGGRBRBBRGBGGGBBRGRRGRBBBRGBBBRBGBRBG
GRBGGRBRRRGBRGGBRGRBBBBBBGGBGRBBGGRRRRGRRRRGRGRBR
GGGRRGGRBRGGBBBBBBBGGRGGBRGGBRRRGBRGGGBRGGBGGBGRG

output:

BGBRGBRBGBGBRGRGBRBRGRBGRGBRGRGRGRBRBRGBRBRBGBRBG
GRGBRGBRBRBRGRGBRGRBRBRBGRGBRGBGRGRGRGRGBRGRBGBRB
RGRGBRGBRGRGBGBRBRBGBRGRBGRGBRGRGBGRGRBRGBRGRBGBG

result:

ok ok

Test #206:

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

input:

3 1
3 1
G
B
R

output:

G
B
R

result:

ok ok

Test #207:

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

input:

1 42
3 21
BRBGBRBRRGBBBGRRRGRBGBBBRGGGBRRGGBBRBBBRGB

output:

BRBGBRBRGRBRBGRGRGRBGBRBRGRGBRGRGBRGBRBRGB

result:

ok ok

Test #208:

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

input:

4 90
3 180
GGGRRBRRGGRBGGRGGRRRGRRRBBBRBGRRBGBBRGGRBRBBGGGRBBRBBGRGRGRGGBGRBRBGGGRRBBGBBRGGGRGBGBGBGR
RRBGGBGGGBBBRRGBBBBBRGGRBGRRBBRGBBRRBBGRRBRBBRRGRRGRRGRBBGGGBRGGRGGGGRGBGBBGBRBRRGGGRGBGRB
GBGGGRBBGRGRRRRBRBBGBRRGGRBBRGBGGGRBRRRGRRGGBGBBGBBGGRGGBGGGBBGRRRRGRRRGRRRGRRBBGRBGGGBRGR
RBBRRBBGBRRBRBGR...

output:

GRGRGBRGRGRBGRGRGRGRGRGRBRBRBGRGBGBRGRGRBRBRGRGRBRGBRGRGRGRGRBGRBRBGRGRGBRGBRGRGRGRBGBGBGR
RGBGRGBRGBGRBGRBRBRBRGRGRGRGRBGRGBRGBGRGRBRBRGRGRGRGBRGBGRGRBRBGRGRBGRGBGBRGBRBRGRGRBGBGRB
GBGRGRGBRGRGRBGRGRBGBRGRGRBRGRBGRGBRGRGRGRGRBRBRGBGRGBRGBGRGRBGRGRGRBGRGRGBRGBRBRGBGRBRBGR
RGBGRBRGBRGBGRBGRGRBRBRBRGR...

result:

ok ok

Test #209:

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

input:

3 34
3 51
GRGRRBGBRRGBRGRRBBBBBRBBGGRRGGBRBG
RGRRGGGBRRRGGBGRGGBBRGRGGRRBBRRGBB
GBBRRBBRRRGBRRGBGBRRGRGGBRRGRRGGGG

output:

GRGRGBGBRGRBRGRGBRBRBRBRGRGRGRBRBG
RGRGRGRGBRGRGBGRGBRBRGRGRGRBRGRGRB
GBGRGBGRGBRBRGRBRGBRGRGRBRGRGRGRGR

result:

ok ok

Test #210:

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

input:

4 9
3 18
GRRGBGRRB
RGGRGGGBB
GGRGRGGBB
BRRBBBRGR

output:

GRGRBGRGB
RGRGRBGBR
GRGRGRBRB
BGRBRBRGR

result:

ok ok

Subtask #8:

score: 0
Wrong Answer

Test #211:

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

input:

42 54
2 1134
GGRRGGGGGGGGRRGGRRRGGGRRGRRGGGGGGRRGGGGGGGGGGRGGRRRGRG
RRRGGGRGGGRRRGGRRRRRRGGRGRGRGGRGGGRGRGRRGRRGGRGRRGGRRR
RGGGRGRGGGRGGGGGRGGRGRGGGGGGGGGRRRGRRGGGRRGRGRGGGGGGRG
RRGRGRRRRRRGGGGGGGRGGGRRRRGRGGRRGGGRGRRRRRGRRGRGRGGRGG
GRGRGRGGGGGGGGRGGGGRGRRGRGRGGGGRGGRRGRRRGRRGRRRRRGGRRG
RGGRRRGGGRGG...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #212:

score: -17
Wrong Answer
time: 0ms
memory: 3616kb

input:

70 95
2 3325
GRRGRGGGGGGRRGGRRGRGRGGRRGGRGGRRGRRRGGRGRGGGGRGRRRRGRGRGGGRRGGRRRGGGGRGRRRRRRRRGRRRGRRGGGRGRGGR
GRGRRRGRGRGRGRRGGRRRRRGGRRGGGRGRRGGGRRRRRRRGGGRRRGRRRRRRGRRGGGGRGGRGGGGGGRGRGGGGRRRGGGRGGGRGGRR
RGGRRGGGGRGGRGRGGGGGRRRRRRGRRGRRGRGGRRGGRRGGGGRRGGRRGRGRGRGRRGRGRRRRGRGGRRRGGRGRGGRGRGRRGRGRGRR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRG...

result:

wrong answer can change at most Q positions

Subtask #9:

score: 0
Wrong Answer

Test #241:

score: 20
Accepted
time: 0ms
memory: 3528kb

input:

68 15
3 510
RRBGRGBBRBRGGGR
GBRRRBBGBRBGBGR
RGGGRBBBGGGGGBG
BRRBRGRRGBRBGRR
BRBBGBRBBRRRRRB
GRRGGGGGGGGGGBR
RBBRRBGRRRGRGRG
GRGGGGRGRRGRRRB
GGBRGBRBRRBRRBG
RGRGBBBGGRGGRGB
BRRGBGRGRGBGBBG
GGRRBBBGRBRBBGB
GBBRBBBBBBRRGBG
BRBGGBBBRRBGGGB
BBGGRBGBRRRBRBG
BGGGBRRBRRGGRBG
RRRBBBGRRBBBBRB
GGRRRGRGGGBBRGB
...

output:

RGBGR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GBGBGRG...

result:

ok ok

Test #250:

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

input:

74 33
3 1221
RGBRBGRGBBBBGBBRRBRGBRBBRBGRBGBRR
RBGRBBBGGRGRGGRBRRGBRGBGGBGBBGGRG
RBGRGRBGGGRBRRRRGGRGRRGRBRGGGBBBB
GGGRGRRGGGRRGGGBRBGRBRRBRGRBGGBBB
BGRRRBRRBBRGGGBRGRBBGRRRGBGRBGBRR
BGBRRGGRRRGRGGGBBGBBGBRRRRGBBGGRG
GBBRGRRRRBGRBRRGGGRRBRGBBRBBRBGGG
BBGRGBBBRRRRRGBBRBGBGRGBGRRGGGBRG
GGRRGRGGGGRGRGG...

output:

RGBRBGRGBRBRGBRGRBRGBRBRGBGRBGBRG
GBGBRBGRGBGBRGBRGRGBRGRGRGRBRBGBR
RGRGBRBGRGRGBRGBRGRGBRGRBRGRGRBRB
GRGRGBRBGRGRGBRGBRGRGBRBRGRBRGRBR
BGRGRGBRBGRGRGBRGBRBRGBRGBGRBRBRG
RBGRGRGBRBGRGRGBRGBRGBRGRGRBRGRGR
GRBGRGRGBRBGBGRGBRGBRGBRBRBRGBGRG
BGRBGBGBRGRBRBGBRBRGBRGBGBRGRGBGR
GRGRBRBGBRGRGRBGBGBRGBRGRGBR...

result:

ok ok

Test #251:

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

input:

98 74
3 3626
BBRRRBBRRGRBGRRGGRGGGGGGBBGBBGBGBGGRGBRRRBGRBBBBBBGGBRRBGGGBBGRGGGRGBBBGGG
BRGBBGRRBGGGRRBRGBRRBGBGGGBRRRRGGBGGBBGGGGRGGGRBBGGGBGGBBGBGRGRGGGGGBGGGRG
BGBBRBBGGRRGBGBGBGGGRGGRGRRRBRBBGBGGGGRRRRRGRBGBRBRRRRBRGBRRGBBBBBRBBGRGRR
GBRGGGBBBRGRRBBRGGBRGRGRGBGBGBRRRBBGRRGBBRRGBGBGRRBBBBBRGGBRGB...

output:

BRGRGBRGRGRBGRGRGRGRGRGRBRGBRGBGBGRGRBRGRBGRBRBRBRGRBRGBGRGBRGRGRGRGBRBGRG
RGRBRGBRBRGRBGBGRBRGBGBGRGBRGRGRGBGRBRGRGRBGRGRBRGRGRGRGBGBGBRGRGRGRGBGRGR
BRBRGBRGRGRGRBRBGRGRGRGRGRGBRGBGRGRGRGRGRGRBGBGRGBGRGRBRGBRBGBRBRBRBRGRGRG
GBRGRGBRBRGRGRBRBGBGRGRGRBRGBRGRGBGRGRGBGRGRBGBGRGBGBGRGRGBRBRBRGRGRBRGRGB
...

result:

ok ok

Test #252:

score: -20
Wrong Answer
time: 0ms
memory: 3536kb

input:

26 26
3 338
RGBRRRGRBGRRGGRRBRGRBRGRGR
BGBGBGGBGRGGGGGRGGRGGGGGRR
GBGBBGGRRBBBBBBGGBRGBBRBRG
BGBGGRBGBRRGRBRRGBBGRGGGGG
BBGRRRBGBBGGBBBRGBBGRGGGBG
RRRGRRRRGRBBBGRBGRRGBBGRBG
GGRBBBBBGBRBGBRBGGRRRRGGRR
GBBBBGBGRBBRGRRRBGRRBRGRGR
GBRRBGBGGRGRGRBGBRRBRBRRGB
GBBBRRBBBGGGBGBRGBRBGBBBGG
GRRRRGBGRBBGGRGGGR...

output:

RGBRGRGRBGRGRGRGBRGRBRGRGR
BRGBRGRBGRGRGRGRGBRGRGRGRG
GBRGBRGRBGBGBGBGRGBRBRGBGR
BGBRGBRGRBRBRBRBGBRGRGRGRG
RBGBRGBRBRGRBRBRBRBRGRGRBR
GRBGBRGBGBRBRGRBGBRGBGRGRG
RGRBRBRGRGBRGBGRBGBRGRGRGR
GBGRBGBRGBRGRGRGRBRGBGRGRG
RGRGRBRGRGBRGRBRBRGBRBGRGB
GBGBGRBRBRGBRGRGRBRGBRBGRG
RGRGRGRGRBRGBRGRGRGBRGRBGB
GRG...

result:

wrong answer can change at most Q positions