QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#401939#8599. Кольорова таблицяdXqwq#100 ✓1ms3864kbC++23742b2024-04-29 16:58:152024-04-29 16:58:15

詳細信息

Subtask #1:

score: 7
Accepted

Test #1:

score: 7
Accepted
time: 1ms
memory: 3620kb

input:

1 34
3 17
GGGRBGGBBGGBGBGBBRGGGRRRBBGGGBBRGB

output:

GRGRBRGRBRGRGRGRBRGRGRGRBRGRGRBRGR

result:

ok ok

Test #2:

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

input:

1 75
3 37
RBRBBBGGRGBGRBBGGRGBGGGGBRBRRGRGRBBRRRGBGGRBRRRRGBRBGGBGBRBBRRRRGRGBBRRBRBG

output:

RBRBRBRGRGRGRBRGRGRBRGRGRGRGRGRGRBRGRGRBRGRBRGRGRBRBRGRGRGRBRGRGRGRBRGRBRBR

result:

ok ok

Test #3:

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

input:

1 23
3 11
GGRRRRBGGRRBGGBGRRBRGRR

output:

GRGRGRBRGRGRGRBRGRBRGRG

result:

ok ok

Test #4:

score: 7
Accepted
time: 1ms
memory: 3756kb

input:

1 75
3 37
RGBGRRRRBRGBRBGRBRRRGRBBRRGBRBBRRGBBRRBRGGBBRRRGGRRBBGBGBRGRBRGRRGRBBGGGRBB

output:

GRBRGRGRBRGRGRGRBRGRGRBRGRGRGRBRGRBRGRBRGRBRGRGRGRGRBRBRBRGRBRGRGRGRBRGRGRB

result:

ok ok

Test #5:

score: 7
Accepted
time: 1ms
memory: 3716kb

input:

1 16
3 8
GRGRGBGBRRBRGBBG

output:

GRGRGRGRGRBRGRBR

result:

ok ok

Test #6:

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

input:

1 60
3 30
BBBGRBBBGBBBRBRGBRGRBRBBRBGGGGRRRGBRGRRGGGRBRRGRBRGRBRGRGBGB

output:

BRBRGRBRGRBRGRGRBRGRBRBRGRGRGRGRGRBRGRGRGRGRGRGRBRGRBRGRGRGR

result:

ok ok

Test #7:

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

input:

1 1
3 0
G

output:

G

result:

ok ok

Test #8:

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

input:

1 49
3 24
RBRGBBGRBRBRRBBRRBBGBGGRGBBBGGBGGRRRBGGRGRRRRBGGR

output:

GRGRBRGRBRBRGRBRGRBRBRGRGRBRGRBRGRGRBRGRGRGRGRGRG

result:

ok ok

Test #9:

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

input:

1 1
3 0
B

output:

B

result:

ok ok

Test #10:

score: 7
Accepted
time: 1ms
memory: 3720kb

input:

1 86
3 43
RRGGGGGRGRBBGBBBGGBRRGBGRRBGRBRBGGBRGGGBBBRGGBBBBBRGGGBGRRRRRBGRGGGBRRBGBRBRRGBGRGRGGG

output:

RGRGRGRGRGRBRBRBRGRGRGRGRGRGRBRBRGRGRGRBRBRGRBRBRBRGRGRGRGRGRBRGRGRBRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #11:

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

input:

1 35
3 17
BGBGGRBBBBRGGRRRRRRGGRGBBGGBRGGBRGG

output:

RGRGRGRBRBRGRGRGRGRGRGRBRGRBRGRBRGR

result:

ok ok

Test #12:

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

input:

1 75
3 37
GRGBGRRGRBGRGGRGBGRBRRBGGBRGRBGGGGRBBBBRRGBRGRGGBBGBRRRGRBGGGRGBGRBBGRRRGBR

output:

RGRBRGRGRBRGRGRGRGRBRGRGRBRGRBRGRGRBRBRGRGRGRGRGRBRBRGRGRBRGRGRBRGRBRGRGRBR

result:

ok ok

Test #13:

score: 7
Accepted
time: 1ms
memory: 3776kb

input:

1 20
3 10
RGRRRGBGBGRGGGGBGGGB

output:

RGRGRGRGRGRGRGRBRGRB

result:

ok ok

Test #14:

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

input:

1 60
3 30
GRRBGBBRRBBRRRBRRBBBRRRGRGBBRBBBGBGGBRGGRRRGGBRRGGGBGRGGRGRG

output:

RGRBRBRGRBRGRGRGRBRBRGRGRGRBRBRBRBRGRGRGRGRGRBRGRGRBRGRGRGRG

result:

ok ok

Test #15:

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

input:

1 4
3 2
RGBB

output:

RGRB

result:

ok ok

Test #16:

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

input:

1 61
3 30
GRGGBRGBRGRRRGBRRRBRGGBBBGBGRBGBBBBRGGRBBBRGGRRGGBBBRRGGGRGRG

output:

GRGRBRGRGRGRGRBRGRBRGRBRBRBRGRGRBRBRGRGRBRGRGRGRGRBRGRGRGRGRG

result:

ok ok

Test #17:

score: 7
Accepted
time: 1ms
memory: 3820kb

input:

1 1
3 0
R

output:

R

result:

ok ok

Test #18:

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

input:

1 45
3 22
GBGRRRRBRRGRGGGRBGGBGBBGRRGRRRRRRGGGGBRRBBGBG

output:

GRGRGRGRGRGRGRGRBRGRGRBRGRGRGRGRGRGRGRGRBRGRG

result:

ok ok

Test #19:

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

input:

1 86
3 43
GGGBGGGRRRGBRGGBGGBGGRGRRGRRBBBBGGGBBGRGRRRBBBGRBGRRGBGRBBBRBBGBBGBBBRBRRBGBGRBBGBGBRR

output:

GRGRGRGRGRGRGRGRGRBRGRGRGRGRBRBRGRGRBRGRGRGRBRGRBRGRGRGRBRBRBRGRBRBRBRBRGRGRGRBRGRGRGR

result:

ok ok

Test #20:

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

input:

1 68
3 34
GGRGBRGRRBGRRGGBGRGGGRBRGBBBBGBRGBGRRRGGGRBRBBRGBRRBRRGRGRBRGBRBGBBR

output:

GRGRBRGRGRGRGRGRGRGRGRBRGRBRBRBRGRGRGRGRGRBRBRGRBRGRGRGRGRBRGRGRGRBR

result:

ok ok

Test #21:

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

input:

1 17
3 8
RGRGRBBRGRGRRGBBG

output:

RGRGRBRGRGRGRGRBR

result:

ok ok

Test #22:

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

input:

1 61
3 30
RRBRRBGRRBBRGGBBGRGRBRRRRBRGGBRGBRGBRGBBGGGBRRRBRBGBRBGGRBRRR

output:

RGRGRBRGRBRGRGRBRGRGRGRGRBRGRBRGRGRBRGRBRGRBRGRBRBRBRBRGRBRGR

result:

ok ok

Test #23:

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

input:

1 5
3 2
RRGBB

output:

GRGRB

result:

ok ok

Test #24:

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

input:

1 50
3 25
RRBRBGRGGGGRGGRGGRRGBBBGBGBBRRGBGBBGGBGRRRBRRGBRRG

output:

GRBRBRGRGRGRGRGRGRGRBRBRBRBRGRGRGRBRGRGRGRBRGRBRGR

result:

ok ok

Test #25:

score: 7
Accepted
time: 1ms
memory: 3832kb

input:

1 94
3 47
GRGBGBRGBBGRBGBRRGBGBBGBGBGGGBRBRGRRGGRRBRRBRGRBGRRGBBBBBGBGBRBBGGBRRGGRRBGRGBRGBBGGGGRRRBGGGR

output:

RGRBRBRGRBRGRGRGRGRGRBRBRBRGRBRBRGRGRGRGRGRBRGRBRGRGRBRBRGRGRGRBRGRGRGRGRBRGRBRGRBRGRGRGRBRGRG

result:

ok ok

Test #26:

score: 7
Accepted
time: 1ms
memory: 3768kb

input:

1 34
3 17
BRBGRBBBRGRRGBGBGRRBGGBBRGGBRGRRBG

output:

RGRGRBRBRGRGRBRBRGRBRGRBRGRBRGRGRG

result:

ok ok

Test #27:

score: 7
Accepted
time: 1ms
memory: 3576kb

input:

1 87
3 43
GRRGRGBGRGRRBBBRBRRBGBGBRBBGRBRBGGRBRGRGGBRGRGRRRGGRGBRGGBRGBRRBGBGRRGRRRBGGRGGGGGBRGRR

output:

RGRGRGRGRGRGRBRGRGRBRBRBRBRGRBRBRGRBRGRGRBRGRGRGRGRGRBRGRBRGRGRBRBRGRGRGRBRGRGRGRGRGRGR

result:

ok ok

Test #28:

score: 7
Accepted
time: 1ms
memory: 3580kb

input:

1 31
3 15
RGGRGRRGGGBGGBBGGRGRRRGRRRGRGBB

output:

GRGRGRGRGRBRGRBRGRGRGRGRGRGRGRB

result:

ok ok

Test #29:

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

input:

1 75
3 37
BBBBGGBRBRRGBBBGBBGRRGBBBBBGRBRRGRGGRRBBBBRGGBRRBRGGBGRGBGBGRBBRRGRBGRRBGBR

output:

RBRBRGRGRGRGRBRGRBRGRGRBRBRGRBRGRGRGRGRBRBRGRBRGRGRGRGRGRGRGRBRGRGRBRGRBRBR

result:

ok ok

Test #30:

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

input:

1 54
3 27
RBBBBBGBGRRGBRBGRRRRRRBBBRRBBBGGGRGBRGRGBGGBRBBGBBGBRG

output:

RBRBRBRBRGRGRGRGRGRGRGRBRGRBRBRGRGRBRGRGRGRBRBRGRBRBRG

result:

ok ok

Subtask #2:

score: 7
Accepted

Test #31:

score: 7
Accepted
time: 1ms
memory: 3776kb

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

score: 7
Accepted
time: 1ms
memory: 3716kb

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

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

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #36:

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

input:

1 96
2 48
GRRGGRRGGRRGGGGGRRGRRGGGRRGRGGRRRGGRRRGGGGRGRGRGGRGGGGRGRGRRGRGGGRRRGGGRGRGGRGRGRRRRRRGRRGRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #37:

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

input:

1 44
2 22
GRRGGRRRRRRRRRRGRRGRRGRGGGGGGGGRGGGGRGRGRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #38:

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

input:

1 88
2 44
GGRRRRGRRGRGGGRGRGRRGRGGGRRGGRRRRGRRGRGRGRRRRGRRRGRRGRRGRRRRGRGGGRRRGRGRGRGGGGGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #39:

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

input:

1 29
2 14
RGGGGRGRRGRRRRGRRRRGRGRGRRRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #40:

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

input:

1 25
2 12
RRGGGGRRRRGGGGRGRRGGGRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #41:

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

input:

1 73
2 36
RRGGRGGRGRRRRRGGRRGGRGRGGRGGGRGRGGGRRRGGRRGRRRRRRGGGRGGGGGGRGRGGGRRRRGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #42:

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

input:

1 22
2 11
RGRRGGGRGGRRGGGRRGRGRR

output:

RGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #43:

score: 7
Accepted
time: 1ms
memory: 3852kb

input:

1 66
2 33
GGRGGGRGRGRGRGRRRRRGGRRRGRGGRGGGGRRRGGGRRGRRGRRGRRRGRRGGGRRRRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #44:

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

input:

1 10
2 5
GRGRRGRGRG

output:

RGRGRGRGRG

result:

ok ok

Test #45:

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

input:

1 51
2 25
GRGGGGGGGRGGRGGRRGGRGRRRGRRRRRGGRRRRGGRGRGGGRRRGGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #46:

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

input:

1 99
2 49
RRRGRGRGGRGGGRGGRRRRGGGRRGGRRRRRGRRGRGGRGRRRRRRGGRGRGGGRRRRGGGGGRGGRRRRRGRGGGRGRRGGGGGRGRGGGRGRRGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #47:

score: 7
Accepted
time: 1ms
memory: 3576kb

input:

1 39
2 19
RGRRRGRRGRGRRGRGRGGRRRRGRRGRRRRRRRGRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #48:

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

input:

1 92
2 46
RGRGGGGRRGRGGRRGRRGGGRGGGGGGRGGRGRGGGGGGGGRRGRRGRGRGGRGGRGRGGGRRRRGRRGRGGRRRGRRGGGRGRRRRRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #49:

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

input:

1 36
2 18
GGGRRGGRRGRRRGRGRRRGGGRGRRRGGGRGGGGG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #50:

score: 7
Accepted
time: 1ms
memory: 3764kb

input:

1 15
2 7
GRRGGRGRGRRRGGG

output:

GRGRGRGRGRGRGRG

result:

ok ok

Test #51:

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

input:

1 59
2 29
RRGRGRGRRRGGRRGGGRGGRGGGGRGGGRRGRRRGGGRRGGRGGGGGGGRRRGGGRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #52:

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

input:

1 99
2 49
RRGGRRRGRRGGGGRGGGGGGRRGRGRGGRGGGRRRRRGRRRRGRGGRGGGRRRRRGGRGGGGGRRGGRGGGRRGGGRGGRGRGGRRGRRGGGRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #53:

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

input:

1 52
2 26
RGGRGRGGGGGRRRRRGRRGGGGGGRRRGRRGRRRGRGRGGRGGRGGRRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #54:

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

input:

1 96
2 48
GGRRGRGGGGGGGGRRGGGGRRRRGGRRGGGRGRRRGGRGRGRRRGGGRGRGGRGRRGRRRGGRGGRGRRGRGRGGGRRRRRRGRGRRRGGGGRRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #55:

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

input:

1 40
2 20
GGRGRRRRGGRRRRGRGGGRGRGRRRGRGGRRGGGGGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #56:

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

input:

1 85
2 42
GRGRGRRRRRRRGGGRGRRRGGRRGGGGRRGRRGGRGGRRRRGGGGGRRRRRGGGRRRGRRGGRGGRGGRGRGRRRRGGRGRRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #57:

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

input:

1 25
2 12
RRGGRRGRRRRGRRRRGGRRRRGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #58:

score: 7
Accepted
time: 1ms
memory: 3624kb

input:

1 70
2 35
RGRRRRGRGRGRGRRGGRGRGGRGGRRGRRRGRGGRRRGGRGGGRGGRGRGRGRGRRRGRRRRGGRRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #59:

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

input:

1 26
2 13
RGRRGRRGGGGGRGGGRRGGGGGGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #60:

score: 7
Accepted
time: 1ms
memory: 3836kb

input:

1 100
2 50
GGGRRGRRRGGGRGGRRGRRGGRRGRGGRGRGGGRRRRRRRGRGRRRGRRRGRGRGGRRRRGGGGGRRGGRGRGGGRGGRRGRGRGRGGRGGRRRGRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Subtask #3:

score: 3
Accepted

Test #61:

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

input:

79 100
3 7900
RRRRBBGGGRGRGRGRGGGGRBBRRRGBRGRGRBBRGGBRRBBRGRGRBBBRGRBBRBBBRGGBGGRBGBBGGGBRGBRRGBBBGGGGRGGGRGRGBBGG
RGBRBGGGGGRBGRGBGGBGRBRBBRBBRRGRGGGBRRBRGRGBBBBRGGGGBGGRGGGGRRBRGRRGGRRBGBGBBGRRGBRBRBBGGRGBRGBRRBRR
RBRRGGBGRRGRGGRRRBGGBRRRRGBRRGBGBBBBRBRBBRBRGRBBGRGRBGGBBRGBGRGBRGRRGRRRRRRBRRRGBBBB...

output:

RGRGRBRGRGRGRGRGRGRGRBRGRGRBRGRGRBRGRGRGRBRGRGRGRBRGRGRBRBRBRGRBRGRBRBRGRGRGRBRGRBRBRGRGRGRGRGRGRBRG
GRBRBRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRGRBRGRGRBRBRGRGRBRGRGRGRGRBRGRGRGRGRGRGRBRGRGRGRGRBRGRGRGRBRGRGR
RBRGRGRGRGRGRGRGRBRGRGRGRGRGRGRGRBRBRBRBRGRGRGRBRGRGRGRBRGRBRGRBRGRGRGRGRGRBRGRGRBRBRBRGRGRGRGRGRG...

result:

ok ok

Test #62:

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

input:

3 45
3 135
RGBBBRRGBBBGRRRRBRBRRGGBBGGRRRBBBGRRGRGGBRRBB
GRRBBBGGRBGRGRBGBRBBBBGBRGGGGBGBBRGGBGRGGRBGR
RRGRGBBGRGBBBRRRBGGGGRRGRGGRRBGBGGBBGBBBGRBBB

output:

GRBRBRGRBRBRGRGRBRBRGRGRBRGRGRBRBRGRGRGRBRGRB
RGRBRBRGRBRGRGRGRGRBRBRBRGRGRBRBRGRGRGRGRGRGR
GRGRGRBRGRBRBRGRBRGRGRGRGRGRGRGRGRBRGRBRGRBRB

result:

ok ok

Test #63:

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

input:

31 89
3 2759
BBBRBRRRBRBRGGBGBRRGBRGGRRGBRRBRRBRBGBRGRBRRRRGBBRRGRRRGBRRGRBRBRRRRGGBRBBGRRBBBBRGBRBBBR
BBRRBRGRRRRGRGRRGBBGRGBGRRGRRGRBGBGGGGBRBBRBBRBRBGBGRBBGRRRGRBGBRBBBGGRRGRBGRBRBRGGGBBRBG
RBBBRBRBRBBBRBRBRBGGGGRBGGRRGGRRGGGGGBGGBGGBRRRBRRGBBGGBRBRGBRGRGGBRGBRBGRGRBRRRGBGBRGGBB
GGBGRRBRRBGGBGRBB...

output:

BRBRBRGRBRBRGRBRBRGRBRGRGRGRGRBRGRGRGRGRGRGRGRGRBRGRGRGRBRGRGRGRGRGRGRBRBRGRGRBRBRGRGRBRG
RBRGRGRGRGRGRGRGRBRGRGRGRGRGRGRBRBRGRGRGRBRBRGRGRGRGRBRGRGRGRBRBRBRBRGRGRGRGRBRBRGRGRBRBR
GRBRGRGRGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRBRGRGRGRBRGRGRBRGRGRGRGRBRGRGRGRGRGRB
RGRGRGRGRBRGRGRBRGRGRGRGRGRGRB...

result:

ok ok

Test #64:

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

input:

51 33
3 1683
GGRBGBGBGBRBRBRGB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RGRGRBRGRB...

result:

ok ok

Test #76:

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

input:

76 30
3 2280
BBGBBGGRGRBGBBRRRGGGGRGBGRGBGR
BBRRBRRBGGRGRGGGGRGGBGGRRBGRRR
RGRGRRBGGGRRBRRRBBGBRRRBGRBRBR
RBGBGBRRGRRGRRRGBGRBGBRRBRGRGG
BBBRGGBGRRBRBBGRRBBRRRRGGBGBBG
GBRGBRGRRRRBGGBBGRRRGGBBBBBRBB
BBGBBRRRBGRBBGGGBBGGRBBGRBBGRG
BBRRGRRRBBGRGGRRRGRRGRRRRBRGGB
GBRGBBBBBBGRGBRBGBGRRBRRRGBGBR
GGRBGBBG...

output:

RBRBRGRGRGRGRBRGRGRGRGRBRGRBRG
BRGRBRGRGRGRGRGRGRGRBRGRGRGRGR
RGRGRGRGRGRGRGRGRBRBRGRBRGRGRG
GRGRGRGRGRGRGRGRBRGRGRGRBRGRGR
RBRGRGRGRGRGRBRGRBRGRGRGRBRBRG
GRGRBRGRGRGRGRBRGRGRGRBRBRBRBR
RBRBRGRGRGRBRGRGRBRGRBRGRBRGRG
BRGRGRGRBRGRGRGRGRGRGRGRGRGRGR
RBRGRBRBRBRGRBRBRBRGRBRGRGRGRG
GRGRGRBRGRBRBRGRBRGRG...

result:

ok ok

Test #77:

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

input:

100 74
3 7400
BRGGBRRBGBBRRBGBGRBGGBRGGBBGRBGGGRBBGRRRBRRGGRGBGRBBBBGBRBGRGRBRRRBRGGBBBR
RRRGBRGRGBBGRRBRGBGBRBBBRBGBBGRGGBBRRGBGGBGRBBRBRRGBBGBRRGGGRGRGBGRGBGRRRR
BBRRGBGGGGGGGBBGRGRBBBGGRRBRRGRGGRGRRRBRGBGRBGBRBRBBRBRRGRRBGRRGBGGRBGGRRG
RBRGBGBGRRRBGBRRBGRRGBBBGBGGRGRRBGGGGBRBGGBBBGGGBRGRGRBBRGGBG...

output:

RGRGRGRBRBRGRBRBRGRGRBR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GBRG
RGBBBRGRBGBRGBG...

output:

BRGRBRGRBRGRBRBRGRGRBRGRGRBRGRGRBRBRBRGRGRGRGRGRGRGRBRGRBRBRBRGRGRG
RGRGRGRGRGRGRGRGRGRBRGRBRGRBRGRGRGRGRBRBRGRBRGRGRGRGRBRBRGRGRBRGRGR
GRBRGRBRBRGRGRGRGRGRGRGRGRBRGRBRGRGRBRGRGRBRGRGRGRBRGRGRBRGRGRBRGRB
RBRBRGRGRGRBRBRGRGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRBRGRBRGRGRGRGR
GRBRBRGRBRBRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #86:

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

input:

91 8
3 728
GGGGRGBG
BGGRBGBG
GRGRRGBR
BRBRGBBR
GBRGGGBG
RBRBBBRB
RBBBGGBR
RGBRGGGB
GRRBGRGG
BRBBGGRR
RBBGRGRG
GRGBGRRB
GRBBBRRR
RGRBGGGG
RRGBBBRG
GRRGRGBB
RBRRBRBB
BRGGRGGR
BBBBRGBG
RBGRGBGR
GBGGGRGB
GBGGRBRG
RBBBRBRR
BBRGBRRR
BBRGBBRB
RRGGBGGR
RBBBGRGB
BRBGGGGB
GRGRRGGR
BBGGRBRR
RRRBBRRR
GRRGGBGR
R...

output:

RGRGRGRG
BRGRBRBR
RGRGRGRG
BRBRGRBR
RBRGRGRG
GRGRBRGR
RBRBRGRG
GRBRGRGR
RGRBRGRG
BRBRGRGR
RBRGRGRG
GRGRGRGR
RGRBRGRG
GRGRGRGR
RGRBRBRG
GRGRGRBR
RBRGRGRB
BRGRGRGR
RBRBRGRG
GRGRGRGR
RBRGRGRB
GRGRGRGR
RBRBRBRG
BRGRBRGR
RBRGRBRB
GRGRBRGR
RBRBRGRB
BRBRGRGR
RGRGRGRG
BRGRGRGR
RGRBRGRG
GRGRGRGR
RGRGRGRG
GRG...

result:

ok ok

Test #87:

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

input:

15 60
3 900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RRRBGRGGB
BGRGGGR...

output:

GRGRBRGRGRBRBRBRGRGRGRBRBRB
RBRBRBRGRGRBRBRGRGRGRGRBRGR
GRGRGRGRGRGRBRGRBRBRGRGRGRG
RBRGRBRBRBRGRGRGRGRGRGRBRBR
GRBRGRBRGRGRBRBRGRGRGRGRBRB
RBRBRGRGRBRBRGRBRBRBRBRBRGR
GRGRBRGRGRGRGRGRGRGRBRBRBRG
RBRBRBRGRGRBRBRBRGRBRBRGRGR
BRGRGRGRBRGRBRGRGRGRBRGRGRG
RBRGRGRGRGRBRGRGRGRGRBRGRGR
BRGRGRGRGRGRBRGRGRGR...

result:

ok ok

Subtask #4:

score: 7
Accepted

Test #91:

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

input:

8 69
3 276
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRB...

output:

GRGRGRBRBRBRBRBRBRBRGRBRGRGRGRGRBRBRBRBRBRGRGRBRGRGRGRGRBRBRBRBRBRBRG
RGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRGRGRGRGR
GRGRGRBRBRBRBRBRBRBRGRBRGRGRGRGRBRBRBRBRBRGRGRBRGRGRGRGRBRBRBRBRBRBRG
RGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRGRGRGRGR
GRGRGRBRBRBRBRBRBRBR...

result:

ok ok

Test #92:

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

input:

32 13
3 208
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGRGBGRG
GRGRGRGR...

output:

GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRGRGRBRGR
GRGRGRGRGRGRG
RGRGRG...

result:

ok ok

Test #93:

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

input:

4 5
3 10
RGRBG
RGRBG
RGRBG
RGRBG

output:

GRGRG
RGRBR
GRGRG
RGRBR

result:

ok ok

Test #94:

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

input:

32 49
3 784
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGRGBGBGBRBGRGRGBGBRGRBRBGRGRBRBRGBRGBRBGB
GBGRGRGBGR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GRGRGRBRGRGRGRGRBRBRBRGRGRBRBRGRGRGRGRGRGRGRGRGRGRBRGR
RBRBRGRGRGRGRGRGRBRBRGRGRBRBRBRGRGRGRGRGRGRGRGRGRBRGRGRGR...

result:

ok ok

Test #106:

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

input:

3 24
3 36
GRGBRBGBGRGBGBRGBRGBRBGB
GRGBRBGBGRGBGBRGBRGBRBGB
GRGBRBGBGRGBGBRGBRGBRBGB

output:

GRGRGRGRGRGRGRGRBRGRGRGR
RGRBRBRBRGRBRBRGRGRBRBRB
GRGRGRGRGRGRGRGRBRGRGRGR

result:

ok ok

Test #107:

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

input:

27 64
3 864
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
GRBRGBRGRGBGRGBRBRBRGRGRBGRBGRGBGRBRBGRGRGBGBGRGBRGBGRBGBGBRBRBR
GRBRGBRGRGBGRGBRBRBRGRGRBGRB...

output:

GRBRGRGRGRBRGRBRBRBRGRGRBRGRGRGRGRBRBRGRGRBRBRGRBRGRGRBRBRBRBRBR
RGRGRBRGRGRGRGRGRGRGRGRGRGRBRGRBRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRG
GRBRGRGRGRBRGRBRBRBRGRGRBRGRGRGRGRBRBRGRGRBRBRGRBRGRGRBRBRBRBRBR
RGRGRBRGRGRGRGRGRGRGRGRGRGRBRGRBRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRG
GRBRGRGRGRBRGRBRBRBRGRGRBRGRGRGRGRBRBRGR...

result:

ok ok

Test #108:

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

input:

51 13
3 331
BGRGBGRBG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GRBRBRBRBRGRGRGRGRGRG
RGRGRGRBRBRGRGRGRBRGRBRBRGRGRGRGRGRGRGRGRGRGRGRBRBRGRBRGR
BRGRBRGRGRGRBRGRGRGRGRGRGRBRBRGRGRBRGRBRBRBRBRGRGRGRGRGRG
RGRGRGRBRBRGRGRGRBRGRBRBRGRGRGRGRGRGRGRGRGRGRGRBRBRGRBRGR
BRGRBRGRGR...

result:

ok ok

Test #110:

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

input:

3 5
3 7
RGRGR
RGRGR
RGRGR

output:

RGRGR
GRGRG
RGRGR

result:

ok ok

Test #111:

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

input:

27 50
3 675
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGRBRBGRBRBGRGBGRGRG
BRBGBGBRGBGRBRGBGBGRBGBRGBRGRGRGR...

output:

BRBRBRBRGRGRBRGRGRGRBRBRGRGRGRGRGRGRGRBRBRGRBRGRGR
RGRGRGRGRBRGRGRBRBRGRGRGRBRGRGRGRBRBRGRGRGRGRGRGRG
BRBRBRBRGRGRBRGRGRGRBRBRGRGRGRGRGRGRGRBRBRGRBRGRGR
RGRGRGRGRBRGRGRBRBRGRGRGRBRGRGRGRBRBRGRGRGRGRGRGRG
BRBRBRBRGRGRBRGRGRGRBRBRGRGRGRGRGRGRGRBRBRGRBRGRGR
RGRGRGRGRBRGRGRBRBRGRGRGRBRGRGRGRBRBRGRGRGRGR...

result:

ok ok

Test #112:

score: 7
Accepted
time: 1ms
memory: 3724kb

input:

51 90
3 2295
GBGBRGRGBGRBGRBGBGBGBRBRBRBR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

output:

RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRGRGRGRBRBRGR
GRBRGRGRBRBRGRGRBRBRGRB
RBRBRBRGRGRG...

result:

ok ok

Test #130:

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

input:

59 51
3 1504
GGGBGBBRGRBRGRRBBRGGRGBGBBBRRBRGBBBGGBGRRRBRGBGRGGG
GGGBGBBRGRBRGRRBBRGGRGBGBBBRRBRGBBBGGBGRRRBRGBGRGGG
GGGBGBBRGRBRGRRBBRGGRGBGBBBRRBRGBBBGGBGRRRBRGBGRGGG
GGGBGBBRGRBRGRRBBRGGRGBGBBBRRBRGBBBGGBGRRRBRGBGRGGG
GGGBGBBRGRBRGRRBBRGGRGBGBBBRRBRGBBBGGBGRRRBRGBGRGGG
GGGBGBBRGRBRGRRBBRGGRGBGBBB...

output:

GRGRGRBRGRBRGRGRBRGRGRBRBRBRGRGRBRBRGRGRGRBRGRGRGRG
RGRBRBRGRGRGRGRBRGRGRGRGRBRGRBRGRBRGRBRGRGRGRBRGRGR
GRGRGRBRGRBRGRGRBRGRGRBRBRBRGRGRBRBRGRGRGRBRGRGRGRG
RGRBRBRGRGRGRGRBRGRGRGRGRBRGRBRGRBRGRBRGRGRGRBRGRGR
GRGRGRBRGRBRGRGRBRGRGRBRBRBRGRGRBRBRGRGRGRBRGRGRGRG
RGRBRBRGRGRGRGRBRGRGRGRGRBRGRBRGRBRGRBRG...

result:

ok ok

Test #131:

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

input:

84 96
3 4032
RGBBBRRBRRRBBBGGRBRB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BR...

output:

GRGRBRBRGRBRBRGRGRGRGRGRBRGRBRGRGRGRBRBRBRGRGRBRGRGRBRGRBRGRBR
RGRGRGRGRGRBRBRGRGRBRGRGRGRGRGRGRBRGRGRBRGRBRGRGRBRGRBRGRGRBRG
GRGRBRBRGRBRBRGRGRGRGRGRBRGRBRGRGRGRBRBRBRGRGRBRGRGRBRGRBRGRBR
RGRGRGRGRGRBRBRGRGRBRGRGRGRGRGRGRBRGRGRBRGRBRGRGRBRGRBRGRGRBRG
GRGRBRBRGRBRBRGRGRGRGRGRBRGRBRGRGRGRBRBRBRGRGRBR...

result:

ok ok

Test #138:

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

input:

64 10
3 320
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BGRRGGRRGG
BG...

output:

BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGRGRGRGRG
BRGRGRGRGR
RGR...

result:

ok ok

Test #139:

score: 7
Accepted
time: 1ms
memory: 3784kb

input:

84 63
3 2646
BRRBGBGBGBGGRRBBR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BRBBRBGRBBRGBBGGRRRRBRBG
RRGBRBB...

output:

RGRBRBRGRGRBRGRBRGRGRGRBRBR
GRGRGRBRBRGRBRGRBRGRGRGRGRG
RGRBRBRGRGRBRGRBRGRGRGRBRBR
GRGRGRBRBRGRBRGRBRGRGRGRGRG
RGRBRBRGRGRBRGRBRGRGRGRBRBR
GRGRGRBRBRGRBRGRBRGRGRGRGRG
RGRBRBRGRGRBRGRBRGRGRGRBRBR
GRGRGRBRBRGRBRGRBRGRGRGRGRG
RGRBRBRGRGRBRGRBRGRGRGRBRBR
GRGRGRBRBRGRBRGRBRGRGRGRGRG
RGRBRBRGRGRBRGRBRGRG...

result:

ok ok

Subtask #6:

score: 13
Accepted

Test #151:

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

input:

4 10
3 26
BGGRRBBRBG
BGBGGBGRRB
RBBBBBRGGR
RGRBGGRGBB

output:

BRGRGRBRBR
RGRGRBRGRB
GRBRBRGRGR
RGRBRGRGRB

result:

ok ok

Test #152:

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

input:

32 55
3 1173
GBBBGBRRBGBGRGRGBRGBRRGGBGRGBRBRGRGGGGGRGGGGGGGGBRBRRGR
BRRRRBBBBGBBGGRRRBGBBGGGBGGGGBRRGBBGBGGRGBGRBGBBBRBGRGG
RGRBRBRRRGBRBRRRGRGBBGBRGGGRRGRRGGBBBGRBRBBRGGGGGGGBGGR
GBRGRBBRRBGGBRBGBGGGGGBGBGBGBGBGRRBBRBBRGRGGRRRGGRGRGBB
GRBBBGBBRGRRRGRGRGGRBBRRBRRBBRRGGGBBGRRBGRBRGBRRGRRRGGG
RRBGBGR...

output:

GRBRGRGRBRBRGRGRBRGRGRGRBRGRBRBRGRGRGRGRGRGRGRGRBRBRGRG
RGRGRBRBRGRBRGRGRBRBRGRGRGRGRBRGRBRGRGRGRBRGRGRBRGRGRGR
GRGRGRGRGRBRBRGRGRGRBRBRGRGRGRGRGRBRBRGRGRBRGRGRGRGRGRG
RBRGRBRGRBRGR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RGRBRBRGRB...

result:

ok ok

Test #156:

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

input:

32 36
3 768
BGGGRRGRBRBRGGBRBBRGRGBRBRBRRRBGBRRG
RGGBGGBGGGBBGBBRBGRGRBBBBGGRGRGRBGBB
GGRGGRGGBBRBBGGBGBBBGRBBRRRRBRGGBBGR
RGRGRRRGBGGBRRBBBBBBGBGGRRRRBBGRGGRB
BBRGGBBRRBRGGBBBGRBRGGBGRRBBGGGBRGRR
BGRRRRGRRGRRBBRGRRRRGBBRBBGRGBBRGGGB
GRRRGRRGBRRGBBRRGGGGBBRRGGGBRRBBGBRR
RGGGRRRGGGRRBRBBBGBGRRBRBBGRB...

output:

BRGRGRGRBRBRGRBRBRGRGRBRBRBRGRBRBRGR
RGRBRGRGRGRBRBRGRGRGRBRBRGRGRGRGRGRB
GRGRGRGRBRGRBRGRGRBRGRBRGRGRBRGRBRGR
RGRGRGRGRGRBRGRBRBRBRBRGRGRGRBRGRGRB
BRGRGRBRGRGRGRBRGRBRGRBRGRBRGRGRGRGR
RGRGRGRGRGRGRBRGRGRGRBRGRBRGRBRGRGRB
GRGRGRGRBRGRBRGRGRGRBRGRGRGRGRBRGRGR
RGRGRGRGRGRGRGRBRGRGRGRGRBRGRGRGRBRG
GRGR...

result:

ok ok

Test #157:

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

input:

60 81
3 3240
BGRBBGBGRBRBBBBBRGRGGRRGGRGGRGBGGRGGBGBBBRBRBRBGGBGGGGRGBGBBBRRGGRGBBGGBRRGRRRBBG
RRRBRRRGBGRRBRBBBRBGGRBRRGRRGGGRGRRBGBBGRRGBRBBBRBRGBBGGGBGRBBRRRRBGGBRBBBBGRBRBG
BRBGGRGRGGBBBRRBGGBBBRRGGGRGGGGGRRBGRBGRRBBRBBGGGRRBGGGGRRGBRGRBGRRRBBGRBBBGRRGBR
BRRBBBGRBRGBBBGGRGBRGGRRBGGGBBGGGRRGBBGRR...

output:

BRGRBRBRGRGRBRBRGRGRGR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BRRRRGBRGRGGGBGRRGRBBBRGGGBRBGBBRGBRGRG
BRBGRGRBRRGRGGGRGBRBBBBRGBRRBRGGBBRBGBBBRGGBGRBRGRRBRRGGGBGBRRRR
RBBGGBGGGBRGBGGBRRGRRRBGGBB...

output:

GRGRGRGRBRBRBRGRGRGRGRGRGRGRGRBRGRGRBRBRGRGRBRGRGRGRGRBRGRGRGRBR
RGRGRGRGRGRBRGRGRBRGRBRBRGRBRGRBRBRGRGRGRGRBRGRGRGRBRBRGRGRGRBRB
BRGRGRBRGRBRBRGRGRBRGRGRBRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRBRGRGRGR
RGRGRGRBRGRGRGRGRBRBRBRGRBRGRGRGRBRBRBRBRGRBRGRGRGRBRGRGRBRBRGRG
GRBRGRGRGRGRBRGRGRGRGRBRGRBRGRGRGRGRBRGR...

result:

ok ok

Test #163:

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

input:

22 8
3 117
BBRRRBBR
GGGBRRRB
GBGBGGBB
RBBGRGGB
GBGRRBGR
GRGBRBBR
GBRRRRGG
BGBRBBRG
RBRBBRRG
GGBRRRGB
RBGGGBGR
RBGGBRRG
BRGBBGRR
BBBRRRRG
BGRRBRRG
BRRGRBBB
RGBGGBBR
BBRGRBGG
BGRBBGBB
RBBRGBRB
RGRRRGRB
RBBRRBBG

output:

BRGRGRBR
RGRBRGRB
GRGRGRBR
RBRGRGRB
GRGRGRGR
RGRBRBRG
GRGRGRGR
RGRGRBRG
GRGRBRGR
RGRGRGRB
GRGRGRGR
RBRGRGRG
BRGRBRGR
RBRGRGRG
BRGRBRGR
RGRGRBRB
GRBRGRBR
RBRGRBRG
BRGRBRBR
RBRGRBRB
GRGRGRGR
RBRGRBRG

result:

ok ok

Test #164:

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

input:

50 53
3 1766
GBRRRRGBGRGBBRGGRGBRGBGGRRBGRRGRRBRRRBRGRGGGGGBBRGGGB
RBGRGBGRRBGGBRGGGRGGGRGGBRRBB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R
RGRGRBRGRBRBRGRBRGRG...

result:

ok ok

Test #169:

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

input:

74 79
3 3897
RBGBBBRRGGRBRRRGRGGRGBGRRGBRGGGGGRBRBBBRBGBRGRBBRBGBGRRRBBBGRGGGRBGBBRGRBRBRBGR
BGGGRRRBBBGRRGBBBGRBBRRGBBBGGGGGRRGBGRGRBBRBBRBGRRBBGRRBRBRBGBGBBRBGBGGBGBGGRGR
BBRRRBGGGRGBGGBBBGRBRBBGRBBGRGBRRBGGRBRRGGBGBRGBBBBGBRGGBGRBRGRRRRGRBRGGGRRBBRR
GRRRBBRRBRGBBGRRBRBGRGBGBBGBGRGBRGBBGRGRRRRGBGG...

output:

GRGRBRGRGRGRGRGRGRGRGRGRGRBRGRGRGRBRBRBRBRBRGRBRGRGRGRGRBRBRGRGRGRGRBRGRBRBRBRG
RGRGRGRBRBRGRGRBRGRBRGRGRBRGRGRGRGRBRGRGRBRBRGRGRGRBRGRBRBRBRBRBRGRGRGRBRBRGRGR
BRGRGRGRGRGRGRBRBRGRGRBRGRBRGRBRGRGRGRGRGRBRBRGRBRBRBRGRBRGRGRGRGRGRBRGRGRGRBRG
RGRGRBRGRGRBRGRGRGRGRGRGRBRBRGRBRGRBRGRGRGRGRGRGRBRGRGRGRBRG...

result:

ok ok

Test #170:

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

input:

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

output:

GRGRGRGRGR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RGRGRGRGRGRBRGRGRGRGRGRGRGR
RGRBRGRGRGRGRBRGRBRGRGRGRGRBRGRGRGRGRBRGRGRBRBRBRGRG

result:

ok ok

Test #182:

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

input:

3 4
3 6
RRRR
GBGR
RRGB

output:

RGRG
GRGR
RGRB

result:

ok ok

Test #183:

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

input:

1 48
3 24
BBGBBRRGGBBRRGRBBBBBRRGBGBRRGGBGRGBBBRRRRRRRGRGB

output:

BRGRBRGRGRBRGRGRBRBRGRGRGRGRGRBRGRBRBRGRGRGRGRGR

result:

ok ok

Test #184:

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

input:

4 93
3 186
RRBRRBGRBBGGGGGGBRGGRBRGGRBRGRBGBRGGRRGGBBRRBBRGGRRBGRGGBRRRBGRBGBGBBRRBBBRBBGBGBBBRBGBBRGGBB
RBRRRBGBRBRGGRRGBGRGBBBBGGBRGBGGGGGBRBRRGGBRRBBGRBBGBGGGGGRBBGBGGBGGRRBBBBRGRGGBRBRRRGGRGRGRB
BGBGGBRGGBGGBRGRGGBBGBGRGRGRGBBGBBRGBRBBRRGBGRGGBRRGGRRGBGGGRRGGRBGGBRBGBBBGBBGRRBBRBRRRRGRRG
BBBGBGB...

output:

GRBRGRGRBRGRGRGRBRGRGRGRGRBRGRBRBRGRGRGRBRGRBRGRGRGRGRGRBRGRBRGRGRGRBRGRBRGRBRBRBRBRBRBRGRGRB
RBRGRBRBRBRGRGRGRGRGRBRBRGRGRBRGRGRBRBRGRGRGRBRGRBRGRGRGRGRBRGRGRBRGRGRBRBRGRGRBRBRGRGRGRGRGR
BRBRGRGRGRGRBRGRGRBRGRGRGRGRGRBRBRGRBRBRGRGRGRGRBRGRGRGRBRGRGRGRGRGRBRBRBRBRBRGRGRBRBRGRGRGRG
RBRGRGRBRGRBRGRGRG...

result:

ok ok

Test #185:

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

input:

4 37
3 74
RGGBBRBRGGGBRGBBGBRGRRBBRGGBBGGBGGGRB
BRGRRGRGRRRRGRRBRRGRBGBRGGRGRGGGBGBRB
RBGRBRGRBBBRRBRRGGBBRBBGBBRGGRRBBGRRG
RGBBBRRBGRGRRGGBGRGGRGGRGGRBBGBGBBRGB

output:

RGRBRGRGRGRBRGRBRBRGRGRBRGRBRGRBRGRGR
BRGRGRGRGRGRGRGRGRGRBRBRGRGRGRGRBRBRB
RBRGRGRGRBRGRBRGRGRBRBRGRBRGRGRBRGRGR
GRBRBRGRGRGRGRGRGRGRGRGRGRGRBRBRBRGRB

result:

ok ok

Test #186:

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

input:

2 77
3 77
GRGRGGRRBBBBGGBRRGGBRRRRBBRBGBGBBBRGGGGBGBGBBBGRGBBBGRGGGGRRBRGGRBRRBBRBGBBRR
GGRRBRRBBBBRBBRBBBGBBGGBBGGBRRBGRRBBGRBBBRGBBBRBRBBGGGRGRGBBBBGRBGRRBRRGRGRBB

output:

GRGRGRGRBRBRGRBRGRGRGRGRBRGRGRGRBRGRGRGRGRGRBRGRGRBRGRGRGRGRBRGRGRGRBRGRGRBRG
RGRGRGRBRBRGRBRBRBRBRGRBRGRBRGRGRGRBRGRBRGRBRBRBRBRGRGRGRGRBRBRGRGRGRGRGRGRBR

result:

ok ok

Test #187:

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

input:

1 22
3 11
RRGBGBGGGBBRRBRGBRGGRG

output:

RGRBRBRGRBRGRBRGRGRGRG

result:

ok ok

Test #188:

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

input:

4 74
3 148
RRBRBBBRBGGBGBBGGBRGRGRGGGGGRGBBBRRRGBBRGGRBBBBGRGRGGBRRBRRRRRBRGGBGRRBGGB
GBBRRGRGBGRRBBBRRBGRRBGGRBBGGGRRBGBGGBGBBRGBRBGGRRGRRBRGRRGGGBBRBRGBBBBBBB
GRRBBGBGBBGBBGRRGGGGBGBGRGRBBBGBBRGRBGRRGBRGRGGRBBBGBBGBGBGRRRGRRRRRBGGBGR
GGGGRBBRGRBGGGRRGGRRRBGGBBBBRGRGBGBGRGRBGGGRBBBBGRGRRRBBRGGGBBRG...

output:

GRBRBRBRBRGRGRBRGRGRGRGRGRGRGRBRBRGRGRBRGRGRBRBRGRGRGRGRBRGRGRBRGRBRGRBRGR
RBRGRGRGRGRGRBRGRBRGRBRGRBRGRGRGRGRGRBRBRGRBRBRGRGRGRBRGRGRGRBRGRGRBRBRBRB
GRGRBRBRBRGRBRGRGRGRBRBRGRGRBRGRBRGRBRGRGRGRGRGRBRBRBRGRGRGRGRGRGRGRBRGRGR
RGRGRBRGRGRGRGRGRGRGRBRGRBRBRGRGRGRGRGRBRGRGRBRBRGRGRGRBRGRGRBRGRGRGRGRGRG

result:

ok ok

Test #189:

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

input:

4 18
3 36
BGRBBGRRBRBRBBGBGR
BBRBBGRBBBBGGBBRGB
GGRRRBRBGRGRGRBGGR
BRRRGGGBGRBRGRRGRG

output:

BRGRBRGRBRBRBRGRGR
RBRBRGRBRBRGRBRGRB
GRGRGRGRGRGRGRBRGR
RGRGRGRBRGRGRGRGRG

result:

ok ok

Test #190:

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

input:

5 45
3 112
BGGBRRBGGGRBBGGRBGGRGGGRBBBBRGGBGBGBBGBRGBRBG
RRRRGRGRRGGGBGBGBBGBGGRBBGGRRRBRGGBGGBRGBRBRR
RBBBBGGRGRRBGBBRGBGGGBRBRRRBRGRRRGBGBGRBBBGBB
BBRRRGRBGRGRBBRBBGBBBBGRBGRGGBBBGRBBRGBGRBGRB
GGBGRBBGGGRBRBBBRRBGBRGGRBBRBGBRBGRBBGGBRGRGR

output:

RGRBRGRGRGRBRGRGRGRGRGRGRBRBRGRBRBRBRGRGRBRBR
GRGRGRGRGRGRBRBRBRGRGRGRBRGRGRBRGRBRGRGRBRBRG
RBRBRGRGRGRBRBRGRBRGRBRBRGRBRGRGRGRGRGRBRBRBR
BRGRGRGRGRGRBRGRBRBRBRGRBRGRGRBRGRBRGRBRGRGRB
RGRGRBRGRGRBRBRBRGRGRGRGRBRGRGRGRGRBRGRBRGRGR

result:

ok ok

Test #191:

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

input:

3 90
3 135
RGBRGRRRRBGBBBRGGRBRBBRBGBRGBGRRRGGGGRBGBBRBBBGGBBRGRRRBBGGBGBGBRGGGGBBBGBRGRBRBBGRBBRRBBB
BRBRBRGBRBBRBGRBBRGBGGBRRBGRBRRRGRRGBRGGGGBBGRBBGBRRRRBBGGGBRGGGBGRBGRBBGGRGBBGBRGBBGRBBGR
BBGRGRGBRBGRGBBGRBRGRRBGRRRGGGGRBBGGBBRBBRRRGRGRBGGBBRBRRGRRBBRBBGRRGRRRGGBGRBBGRBRRGBRGBR

output:

RGRGRGRGRBRBRBRGRGRGRBRBRBRGRGRGRGRGRGRGRBRBRBRGRBRGRGRBRGRBRBRBRGRGRBRBRBRGRBRBRGRBRGRBRB
BRBRBRGRGRBRBRGRBRGRGRBRGRGRBRGRGRGRBRGRGRBRGRBRGRGRGRBRGRGRGRGRBRGRGRBRGRGRBRGRGRBRGRBRGR
RBRGRGRBRBRGRBRGRBRGRGRGRGRGRGRGRBRGRBRBRGRGRGRGRGRBRGRGRGRGRBRBRGRGRGRGRGRGRBRGRBRGRBRGRG

result:

ok ok

Test #192:

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

input:

2 34
3 34
BRRBBBBBGGBBRBRGBRBGRRBGRGRGBGBRBG
BGBBRBRGRGRRRGGRGBBRGGBGRGBRRRRBRG

output:

BRGRBRBRGRBRGRGRBRBRGRBRGRGRBRBRBR
RGRBRBRGRGRGRGRGRBRGRGRGRGRGRGRBRG

result:

ok ok

Test #193:

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

input:

1 74
3 37
BBGRBRGBBBRBGBGRRRGGRRGBGRBGGGBGRGRBRBRGBBRGGBGGRRRGGRRGRGBRGBBBGRBRBRGRGB

output:

BRGRBRGRBRGRGRGRGRGRGRGRGRBRGRBRGRGRGRGRBRGRGRGRGRGRGRGRGRBRGRBRGRBRBRGRGR

result:

ok ok

Test #194:

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

input:

5 27
3 67
RGRRBRRGBBGBRGGRGBGBBBBGBBB
RGGGRBGGGRRBRRRRGRGGBRBRRBR
RGBRRGBGRRRRBBGRRRBBBBBGBGB
BRBRGGRRRGGGGRBRGBRGBGGBGGR
RGRGRBRBBRBGGBRBBGBBGGRGRBB

output:

RGRGRGRGRBRBRGRGRBRBRBRGRBR
GRGRGRGRGRGRGRGRGRGRBRBRGRG
RGRGRGRGRGRGRBRGRGRBRBRGRGR
BRBRGRGRGRGRGRBRGRGRBRGRGRG
RGRGRBRBRGRGRBRBRGRBRGRGRBR

result:

ok ok

Test #195:

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

input:

3 71
3 106
BBBBGBGRBRGBGGRBGGGBGGGRGGRGGGGBGRGGRRGBGGRRGBGBBGGBGRGGRRRRBGRRGGGRRRG
RRBBGRGGBGRBGGRBGRGGBGRBRGGGBRGBGRBGRBGBGRRRRBGBRBBGRBBBGBRGBGRGGGBGBRB
RRBGBRBBBBRBRGGRGGRBBGRRRRRGBBBBBGRRBRGGRBRBGBRBRBRGGBBBGGBBGGBRRGGGGGB

output:

BRBRGRGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRBRGRGRGRGRG
RGRBRGRGRGRBRGRBRGRGRGRBRGRGRGRBRGRGRBRBRGRGRBRBRBRGRBRBRBRGRGRGRGRGRGR
GRBRBRBRBRGRGRGRGRGRBRGRGRGRBRBRBRGRBRGRGRGRGRGRGRGRGRBRGRBRGRBRGRGRGRB

result:

ok ok

Test #196:

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

input:

2 15
3 15
RRBGRBBBGGRBRBB
RRBBRRBRGGRGRRG

output:

RGRGRBRBRGRBRBR
GRBRGRBRGRGRGRG

result:

ok ok

Test #197:

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

input:

1 60
3 30
GBRBBRBBBGGRGBRGGBRRRGGBRRGGGGBRGBBGGRBGGGGRGRGGRBGRGRRRGBGG

output:

GRGRBRBRBRGRGRGRGRGRGRGRGRGRGRBRGRBRGRBRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #198:

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

input:

4 100
3 200
RGBBGGGBBGGRGBRBRRRRBBRGRBBRGRBRGGRRGBBBRBGRGGRBRRBGGBGBBBBRRRRBGBGGBGRRBGBBRRGGBGGBGRBBGGGRBRGRRBBB
RRGGGGGGBRBBRBRRBBRRGRRGRGGGGGBBGRGBBRGBRGRGRBGGGGBGGGBBGBGBRRGBBGRGBGGBBRRRBBGBRGGGBRGBGRGGBRBRGRGR
RGGGGRRRRGRBBGRRRRGGGBGRBGBGRBRBBGGRRRRRRGRGBRRRBBRRGBBBRBRRRGRGBRGGBRGGBBBRGRBGRBRRRB...

output:

RGRBRGRBRGRGRBRBRGRGRBRGRBRGRGRGRGRGRBRBRBRGRGRBRGRGRBRBRBRGRGRBRBRGRGRGRGRBRGRGRGRBRGRBRGRGRGRGRBRB
GRGRGRGRBRBRGRGRBRGRGRGRGRGRGRBRGRGRBRGRGRGRGRGRGRBRGRBRGRGRGRGRBRGRBRGRBRGRBRGRGRGRBRGRGRGRBRBRGRGR
RGRGRGRGRGRBRGRGRGRGRBRGRGRGRBRBRGRGRGRGRGRGRGRGRBRGRBRBRBRGRGRGRGRGRGRGRBRGRGRGRBRGRBRGRGRGRBRBRB...

result:

ok ok

Test #199:

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

input:

3 45
3 67
BGBBRBGRGRBBGBBGGRGRRBBBRBGBBBBGGBGGBBGBGRGRG
RRBRRRRGBBGBGRRGGBRGRGBGGRBBRGGBGGGGRGGBBGGGG
RRBBGGBRRRBGBGGBGGRGGGGGBRGRRBBBBBBGBBBGBBGGB

output:

BRBRGRGRGRBRGRBRGRGRGRBRGRGRBRBRGRGRBRGRGRGRG
RGRGRGRGRBRBRGRGRBRGRGRGRGRBRGRBRGRGRGRBRGRGR
GRBRGRBRGRBRBRGRGRGRGRGRBRGRGRBRBRBRBRBRBRGRB

result:

ok ok

Test #200:

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

input:

5 31
3 77
RBBRGRBBGBBGGBBRRBBBRRRBBRBGBGR
RGGRBBRBGGRBRGGBRRRGBBBBBGBRRBB
BBRRGGRGGRGBBRRRGGBGBGBRBRRRGGG
RBGGRBGBGRRRRRRRGRGBBRGRGRBBGRB
GBBGGBBGGGBBBGRBBBRGRBBBRBBGBGB

output:

RBRGRGRBRBRGRBRGRBRBRGRBRGRGRGR
GRGRBRGRGRGRGRGRGRGRBRBRBRBRGRB
RBRGRGRGRGRBRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRBRGRGRBRGRB
RBRGRBRGRGRBRGRBRBRGRBRBRBRGRGR

result:

ok ok

Test #201:

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

input:

3 75
3 112
BRGGBGGBBBBRBRBGBGBRRBGGBRRRBRBBRGRBGBRRBRBGGBRRBBRGGRBRBGRRGRGRRRGBBBGRRBG
GGGGGBRRBGGBBGGRGBBGBRGGGGRRRGGRBGGGBRRGBBBRRRGGGBBBGBBGRBGBBRRGRBRBRGRBBGB
BBGBGGRGGGGGBGRRRGRGGGBRGRGGGRGRRGRGRBBRGGGBRGRGRRRBBGRBRGBBGGRGGRRRBRBGRGR

output:

BRGRBRGRBRBRBRBRBRBRGRGRBRGRBRBRGRGRGRGRBRBRGRGRBRGRGRBRBRGRGRGRGRGRBRGRGRG
RGRGRBRGRGRBRGRGRBRGRGRGRGRGRGRGRGRGRGRGRBRGRGRGRBRBRBRGRBRBRGRGRBRBRGRBRGR
BRGRGRGRGRGRBRGRGRGRGRBRGRGRGRGRGRGRGRBRGRGRGRGRGRGRBRGRGRBRGRGRGRGRBRBRGRG

result:

ok ok

Test #202:

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

input:

2 16
3 16
GGGRBBGBRBGBRRGR
GBRRRGRRGGRGGGGR

output:

GRGRBRGRGRGRGRGR
RBRGRGRGRGRGRGRG

result:

ok ok

Test #203:

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

input:

1 64
3 32
RRBGRRRRRBRGBGRGRBRGBRBBRGGRGGRRRRBRRRRGBRRRGBRGRRRBBGGRBRGBGRBR

output:

RGRGRGRGRBRGRGRGRBRGRGRBRGRGRGRGRGRGRGRGRGRGRBRGRGRBRGRGRGRBRGRG

result:

ok ok

Test #204:

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

input:

5 8
3 20
RGRBRRRB
BGRBRGGB
GBGGRGGR
GRBBBRRG
BBBBRBGG

output:

RGRBRGRB
BRGRGRGR
RBRGRGRG
GRBRBRGR
RBRBRBRG

result:

ok ok

Test #205:

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

input:

3 49
3 73
BGBBGBRBGBGBBGGRBRBBRGBGGGBBRGRRGRBBBRGBBBRBGBRBG
GRBGGRBRRRGBRGGBRGRBBBBBBGGBGRBBGGRRRRGRRRRGRGRBR
GGGRRGGRBRGGBBBBBBBGGRGGBRGGBRRRGBRGGGBRGGBGGBGRG

output:

BRBRGRGRGRGRBRGRBRBRGRBRGRBRGRGRGRBRBRGRBRGRGRGRG
RGRGRGRGRGRBRGRBRGRBRBRBRGRBRGRBRGRGRGRGRGRGRGRBR
GRGRGRGRBRGRBRBRBRBRGRGRBRGRBRGRGRGRGRBRGRBRGRGRG

result:

ok ok

Test #206:

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

input:

3 1
3 1
G
B
R

output:

R
B
R

result:

ok ok

Test #207:

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

input:

1 42
3 21
BRBGBRBRRGBBBGRRRGRBGBBBRGGGBRRGGBBRBBBRGB

output:

BRBRBRBRGRBRBRGRGRGRGRBRGRGRBRGRGRBRBRBRGR

result:

ok ok

Test #208:

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

input:

4 90
3 180
GGGRRBRRGGRBGGRGGRRRGRRRBBBRBGRRBGBBRGGRBRBBGGGRBBRBBGRGRGRGGBGRBRBGGGRRBBGBBRGGGRGBGBGBGR
RRBGGBGGGBBBRRGBBBBBRGGRBGRRBBRGBBRRBBGRRBRBBRRGRRGRRGRBBGGGBRGGRGGGGRGBGBBGBRBRRGGGRGBGRB
GBGGGRBBGRGRRRRBRBBGBRRGGRBBRGBGGGRBRRRGRRGGBGBBGBBGGRGGBGGGBBGRRRRGRRRGRRRGRRBBGRBGGGBRGR
RBBRRBBGBRRBRBGR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRBRBRBRGRBRBRGRGRBRBRGRGRBRGRBRGRGRGRGRGRBRBRGRGRBRGRBRGRGRGRGRGRGR
RGRGRBRGRBRBRGRBRBRBRGRGRGRGRBRGRBRGRBRGRBRBRGRGRGRGRGRBRGRGRGRGRGRGRGRBRBRGRGRGRGRGRGRGRB
GRGRGRBRGRGRGRGRGRBRBRGRGRBRGRBRGRGRGRGRGRGRBRBRGRBRGRGRBRGRBRGRGRGRGRGRGRGRGRBRGRBRGRBRGR
RBRGRBRGRGRBRBRGRGRGRBRBRGR...

result:

ok ok

Test #209:

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

input:

3 34
3 51
GRGRRBGBRRGBRGRRBBBBBRBBGGRRGGBRBG
RGRRGGGBRRRGGBGRGGBBRGRGGRRBBRRGBB
GBBRRBBRRRGBRRGBGBRRGRGGBRRGRRGGGG

output:

GRGRGRGRGRGRGRGRBRBRBRBRGRGRGRBRBR
RGRGRGRBRGRGRBRGRGRBRGRGRGRBRGRGRB
GRBRGRBRGRGRGRGRGRGRGRGRBRGRGRGRGR

result:

ok ok

Test #210:

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

input:

4 9
3 18
GRRGBGRRB
RGGRGGGBB
GGRGRGGBB
BRRBBBRGR

output:

GRGRBRGRB
RGRGRGRBR
GRGRGRGRB
RGRBRBRGR

result:

ok ok

Subtask #8:

score: 17
Accepted

Test #211:

score: 17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RGRGRGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Test #219:

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

input:

46 13
2 299
RRRGGGGGRRGGG
GRGGRRGGGRRRG
GRRRRRGGRRRRG
GGRRRGRRGRGRR
RRRGRGGRGGRGG
GGGGRRRGRGGGG
RRRGRRRRRRGGR
GRRGRRGRGRRGR
GRRRRRRRRRGRR
GGRGGRRGRRRRR
GRRGGRGRGGGGG
GGRGRRGRGRGRG
RGGGRRRGGGRGG
GRRRRGRGRGGRG
GRGGGRGRRGGGR
RRRRGGGGGGRGR
GGGRRRRGGGGRR
GGGGRRGRRRRGR
RRGRRGRGGRRRR
RRRRRGRRGGRRG
GRRGGGRR...

output:

GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRGRGRGRGR
GRGRGRGRGRGRG
RGRGRG...

result:

ok ok

Test #220:

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

input:

4 80
2 160
RRRRGRRRGRGGGGGRRRRGGGGRRRRGRGGRGRGRGRRGRRGRGRGRGGGRGRRRGRGGRGRRRRRRRGGRGRGRRRGG
RRRGRRGRRGGRGGRRGRGGGRRRGGGRGGGGRGGRGRRGRGRGRRGGGRRRRGGRRRGRRGGRRRRRRGGRGGRGRGGG
GGRGGGGRRGRGGGRRRRRRRGGRGRGRGRRRGRGRGRGGGGGGGGGRRRRGRRGGRRRRGGGGGGGGGRGGGRRRGRRR
RGRGRGGGRGGRGGRGRGRGGRGRRRGRGRGGGGRRRRRGGRRGRG...

output:

GRG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RGRRRRGRGRRGGGRRRRGG
RGGRGRGRRGRGRR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #228:

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

input:

4 35
2 70
GGGGGRGRRGRGGRGRGRRRGRGRGRGGGRGGGGG
RGRRGRGGGGRGRGGGRRGRRGGRRRGRGGGGGRR
RRRRRRRGGGGRGRGRRRGGGRGGRGGRRRGRGRG
GRRGRRRRRRGRRRGRGGRRGGGRGGGRRGGGRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #229:

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

input:

28 79
2 1106
GGGRRRGRRRRRRGGRGGGRGRRRRGGGGRGGRGGGGRGGGRGGGRGGGGRGRRGGRRGRGGGRRGRGGRGRGRRRGGR
GRRRRRGRGGRGGRGRRGRGRRGRRGRRRGGRGRGGGRGGRRGGRRGGGRRGRGGRRRGGRGGRGGGRGGGRGGRGRGG
GGRRRRRRGGGGRRGRRGRRRGRRRGRRRGRGGGRRGGGGRRRGRRGGRGRRGRGRGRGGGRRRGRRRRRGGRGGRGGG
RRGGRGGRRRRRGRGGRGRRRGGGRGGGRGRGRRGGGGGRGGRGGGR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Test #230:

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

input:

19 65
2 617
RGGGGGGRRRRRRGRGGRRGGRGGRRRGGRRGRGGRGRGGGRRGRGRRRGRGGRGRRGRRGRGGG
RGGGGRRRGGRRGRGRRGGGRGGGRRRGGGRGRGGGRGRRGGRRGRRGRRGGRGRGRGRGRRGGR
RGGRGGGRGGGGRRGRGGGRGGGGGGGGGRRGGRRRRRGGGGRGRGGRRRGGGGRGRGRRGGRGR
GGRRRRGGGGGRRGRGGRGGGRGGRRRRGRGGGRRGGGGGRRGRRGGRGRGRGGRGRRGGGRRGG
GGRGGGGRRRGGGRGGGRGGRRRR...

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Test #231:

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

input:

39 6
2 117
RRGRGG
RRRGGG
GRRRGG
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GRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Test #236:

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

input:

67 36
2 1206
RRGRGGRRRRRGRRRGRRGGGRGGGGRGRGRGGRGG
GRRRGRRGGGRRRRGGRGRRRRRGRGRGGRGGRGGG
RRRRGRGRRGGRRGGGGGGRRGRRRRRGRRGRRGGR
GRGRGRGRRRGGRGRGRGRRRGRRGRGRGGGGRRGG
GGGRGGRRGGRGRGGRRGRRRRRRRGRGGRGGRRRG
GGGGGRGRGGRRGRRRGRRGRRGGRRGRGRGGGRGR
GGGRGGGRGGGRGRGRGRGRRRGGRGRRGGRGGRRR
GGRRRGRRGGRGGGRRGRGGGRGGGGRG...

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRG...

result:

ok ok

Test #237:

score: 17
Accepted
time: 1ms
memory: 3788kb

input:

100 100
2 5000
RRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
RRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGGGGGGGGGGGGGGGGGGG
RRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGGGG...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #238:

score: 17
Accepted
time: 1ms
memory: 3832kb

input:

100 100
2 5000
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR
RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRGGGGGGGGGGRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #239:

score: 17
Accepted
time: 1ms
memory: 3592kb

input:

100 100
2 5000
RRRRRRRRRRRRRRRGGGGGGG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GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Subtask #9:

score: 20
Accepted

Test #241:

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

input:

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

output:

RGRGRGRBRBRGRGR
GRGRGRBRBRBRBRG
RGRGRBRBRGRGRBR
BRGRGRGRGRGRGRG
RGRBRBRBRGRGRGR
GRGRGRGRGRGRGRG
RBRGRBRGRGRGRGR
GRGRGRGRGRGRGRB
RGRGRBRBRGRGRBR
GRGRBRBRGRGRGRB
RGRGRGRGRGRGRBR
GRGRBRBRGRGRBRB
RBRGRBRBRBRGRBR
BRBRGRBRGRBRGRB
RBRGRBRBRGRBRBR
BRGRBRGRGRGRGRG
RGRBRBRGRBRBRGR
GRGRGRGRGRBRGRB
RGRBRBRGRGRB...

result:

ok ok

Test #242:

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

input:

88 67
3 2948
RRBRGRGBRBRGGGRRGRGRRGRBRGGGRRRRGGRGRRGGRRGGGRRBRBBRBGRRRBRRRGGRBBB
RGGGBBBGBBRGRRBBBBGRBBGBGBBRRGBBRRGBGBBGBBGGRGGRRR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BRGRGR
RBRGRGRGRGRGRGRBRBRBR...

result:

ok ok

Test #246:

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

input:

89 40
3 1780
RRRRGRBGRGBGGGBGGBRRGBBGRBRBGRBBGGRGRBRG
BRBRGGGRBRRRBRBBRRRBBGRBGRRBGGRGGRGBRGBB
BBRBGRGGBGRRGBBGRGBBRGBBGRGGBRBBGBGRRGBR
RRBGBRRBBGRGGBGBRBRGBGBBGRBBBGBGGGRBRRRG
GGRGBGGRRRBRGGRGRBBRRBRGRGRRGGRGGGRGGGBG
RRRBGRRRBRGRGBGGGRBRRRBBGRRBRRRBBRGBBRBB
BBBBGGRBBRGBGRRGBRRRGRBRGBGRBGBRRBBGRRRG
...

output:

GRGRGRBRGRBRGRBRGRGRGRBRGRGRGRBRGRGRGRGR
RGRGRGRGRGRGRGRBRGRBRGRBRGRBRGRGRGRBRGRB
BRGRGRGRBRGRGRBRGRBRGRBRGRGRBRBRGRGRGRBR
RGRGRGRBRGRGRBRBRBRGRGRBRGRBRGRGRGRBRGRG
GRGRBRGRGRBRGRGRGRBRGRGRGRGRGRGRGRGRGRBR
RGRBRGRGRGRGRBRGRGRGRGRBRGRBRGRBRGRBRGRB
BRBRGRGRBRGRGRGRBRGRGRBRGRGRBRBRGRBRGRGR
RGRGRGRBRGRBR...

result:

ok ok

Test #247:

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

input:

17 85
3 722
BRRBBGBGBGBBRBBGRRBGRBBBRGBBBRBGGBRRBRRGRBRBBRBBBRGRGGGBBRRGRBBBGRBGGBRRBRRRGGGRRRBGB
GGRBRBRGGRRBBBRBRRBBRGGRGGRBRGBGRBRGBGRGBBBRRRRGBGBRBRBBGBBRBBRRBBRRBBGRRBBBGRBRGGGGG
BRGRRGGGRGBGRRRGBRRRGBRGRRBRGBRRGGRGGRRBRRGRGBGBBRRRGGBBBGGRRBBBRBBBGRBBGGGGGRBRRRGBR
GBGGBGBGBBBRRGRBGGRGGGGBGBBBGB...

output:

BRGR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GGBRGBGGRRRGRRGRGRBBBGRGBBGGBBBRBBGGBGG...

output:

RBRBRGRGRGRBRGRGRGRBRGRBRGRGRBRGRBRGRGRGRGRGRGRBRGRBRBRGRGR
GRBRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRBRBRGRGRGRBRBRGRBRGRGRGRB
RBRBRGRBRBRBRGRGRBRGRBRBRGRGRGRBRGRBRGRGRBRGRGRGRBRGRGRGRBR
GRGRGRBRGRGRBRGRGRGRGRBRGRGRBRGRGRGRBRGRBRGRBRGRGRGRGRBRGRG
RBRGRGRGRGRGRBRGRGRGRGRGRGRBRGRGRBRGRBRGRBRGRGRGRGRBRGRBRBR
...

result:

ok ok

Test #256:

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

input:

26 3
3 39
GRG
GGG
RGG
BGR
BGB
BRG
BBR
GRG
RRR
GRG
GRG
GBR
BBR
RBR
GBR
BRG
BBB
GBR
RGB
GRG
BBB
RBB
BBR
BBR
GGG
BGR

output:

RGR
GRG
RGR
BRG
RGR
BRG
RBR
GRG
RGR
GRG
RGR
GRG
RBR
GRG
RBR
BRG
RBR
GRG
RGR
GRG
RBR
GRB
RBR
BRG
RGR
BRG

result:

ok ok

Test #257:

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

input:

46 52
3 1196
BBBBRGRBRBBRRGBGGGBRBGBGBGGRRBRGRRRGBBBRGRBBBRBGRGRR
GBBRRGGGRRRGRBGBBGGBBGBRBGGRGRBGGGRRGBGRRRRBBRBRGRRB
RBBBBBGBBRGRGBRRRBBBRRRGBRRGBGRRGBBRGGRGBBGGRBRGGBGG
GBBBBGBGBRRBBGBGRRBGGBBGRRGBBGRGRRRBBRBBGRBGRRRGGGRG
GBRBBBBRBGBBGGGRBGGRGGRRGBBGRGRBRRRBBRGBBGRGRRBRGRGB
GGGBRGRGBBGRRRBBRGGBBG...

output:

RBRBRGRBRBRGRGRGRGRGRGRGRGRGRBRGRGRGRBRGRGRBRGRGRGRG
GRBRGRGRGRGRGRGRBRG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GRGRBRBRG...

result:

ok ok

Test #264:

score: 20
Accepted
time: 1ms
memory: 3708kb

input:

97 100
3 4850
BGBRRBRBBRBBBBGRGBRBRBGBRGGGRBGBGBBGRRGRGRRGRGRRGRBRGRGGGBRBGRRGBRRGBRBBBBGBRBGRGGBBRGBGRRGRRGBRBGBG
RGRGGRBRGRGRRGGRGRRRRBGBBGRRRGBGBRGBRRRBGRGBRBRGRRRGGBBBRRGBGGRRRGRRRRRRRRBRRGGGBRGGBRBGBGBGRGRBBBRG
BGBBRGBRRRGGRRRRRRBBBGGRBBGBRGRRBGRRBGBGBRBRBGRRBRBBBRGBRRBRRBGBGBBRBBBGGRRRBRRBBRRB...

output:

RGRGRBRBRGRBRBRGRBRBRBRBRGRGRBRBRBRGRGRGRGRGRGRGRGRGRGRGRBRBRGRGRGRGRGRBRBRBRBRGRGRBRGRGRGRGRGRGRGRG
GRGRGRBRGRGRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRGRGRGRGRBRGRGRBRGRBRBRBRBRGRGRBRGR
RGRBRGRGRGRGRGRGRGRBRGRGRBRBRGRGRGRGRGRGRGRGRGRGRGRBRGRBRGRGRBRBRBRGRBRGRGRGRGRBRGRBRGRBRGRBRBRBRG...

result:

ok ok

Test #265:

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

input:

21 45
3 472
RRGGRRBBGGBGGBRBBBGBGBRGGBGGBGRRRGRGRBRBGRGBR
BRBBGBRRRBRGBGBGRBBGGRRRRRBBBBBRGBRRRRRGGRBRG
BBRGGBGGGRRRRBBGRRRRRBRBRBGBBBRGGRRGBRBRRBGGG
RGBGGGBGBGBRRBRBBRBGRGRGRRRGGGGBBBBBBRBBRGRBB
GBRBGBGBRRGGRGGBRRBGRGRRRGRBRBGRGRGBRRBGBRRGB
BRGBBBRBRRRBRRGBBBRBBGGBRRBGBGRBRRBBRBBRBGRRR
RRRBGGGGRGBR...

output:

GRGRGRBRGRBRGRGRBRGRGRGR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RBRGRGRGRGRBRGRGRGRGRBR
RGRBRGRGRGRBRGRBRGRBRBRBRBRGRBRBRGRBRGRGRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRGRGRBRG
BRGRBRGRBRGRGRBRGRBRGRBRBRGRGRGRGRGRBRBRGRGRBRBRGRBRGRGRGRGRGRG...

result:

ok ok

Test #269:

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

input:

21 26
3 273
GGBRBRRRRRRGGBRBRBRGGRRGRR
GBBBGBGRBBBBBGRBGBBBGBGRBG
GGBBRRRGBRRRGRGBRGRRRGRGGR
RRGRBGRRGRGRRGRBGRGBRGRRGG
BGRBGBRGGRRGRBBBGGBRRBGBRR
BGGGBBBBGGGRGRGGBBBGRRRRGR
RBRGBRGBBRRRBBBGRBBGGRBRRR
GGBGGRGRRGBGBRRGBRGBGRGGRG
BGRRBBRGGGGRRGRBRRRRGBBBRR
GRBGRBBGBBGRGBBBBGGBRBBRRG
GBBRGRBRRGBRBBGRGR...

output:

GRBRBRGRGRGRGRGRGRGRGRGRGR
RBRBRBRGRBRBRGRBRBRBRBRGRG
GRBRGRGRBRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRBRGRBRGRGRG
BRGRGRGRGRGRGRBRGRBRGRGRGR
RGRGRBRBRGRGRGRGRBRGRGRGRG
GRGRBRGRBRGRBRBRGRBRGRBRGR
RGRGRGRGRGRGRGRGRGRBRGRGRG
BRGRBRGRGRGRGRGRGRGRGRBRGR
RGRGRBRGRBRGRBRBRGRBRBRGRG
GRBRGRBRGRBRBRGRGRGRGRBRGR
RBR...

result:

ok ok

Test #270:

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

input:

11 5
3 27
BBGRR
BRBBB
BGBRG
BRGBB
GRGGR
GGRRG
RRRBG
RBBGR
RGRBG
BGRRR
GBGRG

output:

BRGRG
RGRBR
BRBRG
RGRBR
GRGRG
RGRGR
GRGRG
RBRGR
GRGRG
RGRGR
GRGRG

result:

ok ok

Test #271:

score: 20
Accepted
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GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRBRBRBRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRBRBRBRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #273:

score: 20
Accepted
time: 1ms
memory: 3864kb

input:

100 100
3 5000
RRRRRBBBBBRRRRRRRRRRBBBBBBBBBBRRRRRRRRRRRRRRRBBBBBRRRRRGGGGGGGGGGGGGGGRRRRRRRRRRGGGGGGGGGGRRRRRBBBBB
RRRRRBBBBBRRRRRRRRRRBBBBBBBBBBRRRRRRRRRRRRRRRBBBBBRRRRRGGGGGGGGGGGGGGGRRRRRRRRRRGGGGGGGGGGRRRRRBBBBB
RRRRRBBBBBRRRRRRRRRRBBBBBBBBBBRRRRRRRRRRRRRRRBBBBBRRRRRGGGGGGGGGGGGGGGRRRRRRRRRRGGG...

output:

GRGRGRBRBRGRGRGRGRGRBRBRBRBRBRGRGRGRGRGRGRGRGRBRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRBR
RGRGRBRBRBRGRGRGRGRGRBRBRBRBRBRGRGRGRGRGRGRGRBRBRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRBRB
GRGRGRBRBRGRGRGRGRGRBRBRBRBRBRGRGRGRGRGRGRGRGRBRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBR...

result:

ok ok

Test #274:

score: 20
Accepted
time: 1ms
memory: 3768kb

input:

100 100
3 5000
GGGGBBBBRRRRBBBBRRRRRRRRRRRRBBBBBBBBRRRRBBBBBBBBGGGGRRRRGGGGBBBBBBBBBBBBBBBBBBBBGGGGBBBB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