QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393248#8599. Кольорова таблицяNetwork_Error93 1ms3776kbC++142.1kb2024-04-18 13:29:082024-04-18 13:29:09

Judging History

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

  • [2024-04-18 13:29:09]
  • 评测
  • 测评结果:93
  • 用时:1ms
  • 内存:3776kb
  • [2024-04-18 13:29:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define pii pair<int,int>
#define piii tuple<int,int,int>
#define mp make_pair
#define mt make_tuple
#define fi first
#define se second
#define deb(var) cerr<<#var<<'='<<(var)<<"; "
//#define int long long
int n,m,c,L,a[110][110];
void out(int x){
	cout<<(x==0?'R':x==1?'G':'B');
}
void work(){
	cin>>n>>m>>c>>L;
	for(int i=1;i<=n;i++){
		char c;for(int j=1;j<=m;j++){
			cin>>c;a[i][j]=c=='R'?0:c=='G'?1:2; 
		}
	}
	if(c==2){
		int sum=0;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)sum+=a[i][j]!=(i+j)%2;
		if(sum<=L){
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++){
					out((i+j)&1);if(j==m)cout<<'\n';
				}
		}else{
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++){
					out((i+j+1)&1);if(j==m)cout<<'\n';
				}
		}
	}else{
		int sum=0,cnt=0;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)if(a[i][j]!=2)cnt++,sum+=a[i][j]!=(i+j)%2;
		if(sum<=cnt/2){
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++){
					if(a[i][j]!=2)a[i][j]=(i+j)&1;
				}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=m;j++){
					if((i+j+1)&1)continue;
					if(a[i][j]!=2||a[i-1][j]!=2&&a[i+1][j]!=2&&a[i][j-1]!=2&&a[i][j+1]!=2)continue;
					int x=0;
					if(i>1&&a[i-1][j]!=2)x=a[i-1][j]; 
					if(i<n&&a[i+1][j]!=2)x=a[i+1][j]; 
					if(j>1&&a[i][j-1]!=2)x=a[i][j-1]; 
					if(j<m&&a[i][j+1]!=2)x=a[i][j+1];a[i][j]=!x;
				}
			}
		}else{
			for(int i=1;i<=n;i++)
				for(int j=1;j<=m;j++){
					if(a[i][j]!=2)a[i][j]=(i+j+1)&1;
				}
			for(int i=1;i<=n;i++){
				for(int j=1;j<=m;j++){
					if((i+j)&1)continue;
					if(a[i][j]!=2||a[i-1][j]!=2&&a[i+1][j]!=2&&a[i][j-1]!=2&&a[i][j+1]!=2)continue;
					int x=0;
					if(i>1&&a[i-1][j]!=2)x=a[i-1][j]; 
					if(i<n&&a[i+1][j]!=2)x=a[i+1][j]; 
					if(j>1&&a[i][j-1]!=2)x=a[i][j-1]; 
					if(j<m&&a[i][j+1]!=2)x=a[i][j+1];a[i][j]=!x;
				}
			}
		}
		for(int i=1;i<=n;i++){
			for(int j=1;j<=m;j++)out(a[i][j]);cout<<'\n';
		}
	}
}
signed main(){
	ios::sync_with_stdio(0),
	cin.tie(0),cout.tie(0);
	int T=1;while(T--)work();return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 7
Accepted

Test #1:

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

input:

1 34
3 17
GGGRBGGBBGGBGBGBBRGGGRRRBBGGGBBRGB

output:

GRGRBRGBGRGBGBGBGRGRGRGRGBGRGBGRGB

result:

ok ok

Test #2:

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

input:

1 75
3 37
RBRBBBGGRGBGRBBGGRGBGGGGBRBRRGRGRBBRRRGBGGRBRRRRGBRBGGBGBRBBRRRRGRGBBRRBRBG

output:

RBRGBGRGRGBGRGBGRGRBRGRGBGBGRGRGRGBGRGRBRGRBRGRGRBRBRGBGBGBGRGRGRGRGBGRBRBR

result:

ok ok

Test #3:

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

input:

1 23
3 11
GGRRRRBGGRRBGGBGRRBRGRR

output:

GRGRGRBRGRGBGRBRGRBRGRG

result:

ok ok

Test #4:

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

input:

1 75
3 37
RGBGRRRRBRGBRBGRBRRRGRBBRRGBRBBRRGBBRRBRGGBBRRRGGRRBBGBGBRGRBRGRRGRBBGGGRBB

output:

GRBRGRGRBRGBGBGRBRGRGRGBGRGBGBGRGRGBGRBRGRGBGRGRGRGBGRBRBRGRBRGRGRGBGRGRGBG

result:

ok ok

Test #5:

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

input:

1 16
3 8
GRGRGBGBRRBRGBBG

output:

GRGRGBGBGRBRGBGR

result:

ok ok

Test #6:

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

input:

1 60
3 30
BBBGRBBBGBBBRBRGBRGRBRBBRBGGGGRRRGBRGRRGGGRBRRGRBRGRBRGRGBGB

output:

GBGRGBGBGBGBGBGRBRGRBRGBGBGRGRGRGRBRGRGRGRGBGRGRBRGRBRGRGBGB

result:

ok ok

Test #7:

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

input:

1 1
3 0
G

output:

G

result:

ok ok

Test #8:

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

input:

1 49
3 24
RBRGBBGRBRBRRBBRRBBGBGGRGBBBGGBGGRRRBGGRGRRRRBGGR

output:

GBGRGBGRBRBRGBGRGBGRBRGRGBGBGRBRGRGRBRGRGRGRGBGRG

result:

ok ok

Test #9:

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

input:

1 1
3 0
B

output:

B

result:

ok ok

Test #10:

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

input:

1 86
3 43
RRGGGGGRGRBBGBBBGGBRRGBGRRBGRBRBGGBRGGGBBBRGGBBBBBRGGGBGRRRRRBGRGGGBRRBGBRBRRGBGRGRGGG

output:

RGRGRGRGRGBGRGBGRGBGRGBGRGBGRBRBRGBGRGRGBGRGRGBGBGRGRGBGRGRGRBRGRGRBRGBGBGBGRGBGRGRGRG

result:

ok ok

Test #11:

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

input:

1 35
3 17
BGBGGRBBBBRGGRRRRRRGGRGBBGGBRGGBRGG

output:

BGBGRGBGBGRGRGRGRGRGRGRGBGRBRGRBRGR

result:

ok ok

Test #12:

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

input:

1 75
3 37
GRGBGRRGRBGRGGRGBGRBRRBGGBRGRBGGGGRBBBBRRGBRGRGGBBGBRRRGRBGGGRGBGRBBGRRRGBR

output:

GRGBGRGRGBGRGRGRBRGBGRBRGBGRGBGRGRGBGBGRGRBRGRGRGBGBGRGRGBGRGRGBGRGBGRGRGBG

result:

ok ok

Test #13:

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

input:

1 20
3 10
RGRRRGBGBGRGGGGBGGGB

output:

RGRGRGBGBGRGRGRBRGRB

result:

ok ok

Test #14:

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

input:

1 60
3 30
GRRBGBBRRBBRRRBRRBBBRRRGRGBBRBBBGBGGBRGGRRRGGBRRGGGBGRGGRGRG

output:

RGRBRGBGRGBGRGBGRGBGRGRGRGBGRGBGRBRGBGRGRGRGRBRGRGRBRGRGRGRG

result:

ok ok

Test #15:

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

input:

1 4
3 2
RGBB

output:

RGBG

result:

ok ok

Test #16:

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

input:

1 61
3 30
GRGGBRGBRGRRRGBRRRBRGGBBBGBGRBGBBBBRGGRBBBRGGRRGGBBBRRGGGRGRG

output:

GRGRBRGBGRGRGRBRGRBRGRGBGRBRGBGBGBGRGRGBGBGRGRGRGBGBGRGRGRGRG

result:

ok ok

Test #17:

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

input:

1 1
3 0
R

output:

R

result:

ok ok

Test #18:

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

input:

1 45
3 22
GBGRRRRBRRGRGGGRBGGBGBBGRRGRRRRRRGGGGBRRBBGBG

output:

GBGRGRGBGRGRGRGRBRGBGBGRGRGRGRGRGRGRGBGRGBGBG

result:

ok ok

Test #19:

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

input:

1 86
3 43
GGGBGGGRRRGBRGGBGGBGGRGRRGRRBBBBGGGBBGRGRRRBBBGRBGRRGBGRBBBRBBGBBGBBBRBRRBGBGRBBGBGBRR

output:

GRGBGRGRGRGBGRGBGRBRGRGRGRGRGBGBGRGBGRGRGRGBGBGRBRGRGBGRGBGRGBGBGRGBGRBRGBGBGRGBGBGBGR

result:

ok ok

Test #20:

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

input:

1 68
3 34
GGRGBRGRRBGRRGGBGRGGGRBRGBBBBGBRGBGRRRGGGRBRBBRGBRRBRRGRGRBRGBRBGBBR

output:

GRGRBRGRGBGRGRGBGRGRGRBRGBGBGRBRGBGRGRGRGRBRGBGRBRGBGRGRGRBRGBGBGBGR

result:

ok ok

Test #21:

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

input:

1 17
3 8
RGRGRBBRGRGRRGBBG

output:

RGRGRGBGRGRGRGBGR

result:

ok ok

Test #22:

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

input:

1 61
3 30
RRBRRBGRRBBRGGBBGRGRBRRRRBRGGBRGBRGBRGBBGGGBRRRBRBGBRBGGRBRRR

output:

RGBGRBRGRGBGRGBGRGRGBGRGRBRGRBRGBGRBRGBGRGRBRGRBRBRBRBRGRBRGR

result:

ok ok

Test #23:

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

input:

1 5
3 2
RRGBB

output:

GRGBG

result:

ok ok

Test #24:

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

input:

1 50
3 25
RRBRBGRGGGGRGGRGGRRGBBBGBGBBRRGBGBBGGBGRRRBRRGBRRG

output:

RGBGBGRGRGRGRGRGRGRGBGBGBGBGRGRBRGBGRBRGRGBGRGBGRG

result:

ok ok

Test #25:

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

input:

1 94
3 47
GRGBGBRGBBGRBGBRRGBGBBGBGBGGGBRBRGRRGGRRBRRBRGRBGRRGBBBBBGBGBRBBGGBRRGGRRBGRGBRGBBGGGGRRRBGGGR

output:

RGRBRBRGBGRGBGBGRGBGBGRBRBRGRBRBRGRGRGRGBGRBRGRBRGRGBGBGBGBGBGBGRGBGRGRGRBRGRBRGBGRGRGRGRBRGRG

result:

ok ok

Test #26:

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

input:

1 34
3 17
BRBGRBBBRGRRGBGBGRRBGGBBRGGBRGRRBG

output:

BGBGRGBGRGRGRBRBRGRBRGBGRGRBRGRGBG

result:

ok ok

Test #27:

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

input:

1 87
3 43
GRRGRGBGRGRRBBBRBRRBGBGBRBBGRBRBGGRBRGRGGBRGRGRRRGGRGBRGGBRGBRRBGBGRRGRRRBGGRGGGGGBRGRR

output:

RGRGRGBGRGRGBGBGBGRBRBRBRGBGRBRBRGRBRGRGRBRGRGRGRGRGRBRGRBRGBGRBRBRGRGRGRBRGRGRGRGBGRGR

result:

ok ok

Test #28:

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

input:

1 31
3 15
RGGRGRRGGGBGGBBGGRGRRRGRRRGRGBB

output:

GRGRGRGRGRBRGBGRGRGRGRGRGRGRGBG

result:

ok ok

Test #29:

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

input:

1 75
3 37
BBBBGGBRBRRGBBBGBBGRRGBBBBBGRBRRGRGGRRBBBBRGGBRRBRGGBGRGBGBGRBBRRGRBGRRBGBR

output:

BGBGRGBGBGRGBGBGBGRGRGBGBGBGRBRGRGRGRGBGBGRGRBRGBGRGBGRGBGBGRGBGRGRBRGRBRBR

result:

ok ok

Test #30:

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

input:

1 54
3 27
RBBBBBGBGRRGBRBGRRRRRRBBBRRBBBGGGRGBRGRGBGGBRBBGBBGBRG

output:

RGBGBGRBRGRGBGBGRGRGRGBGBGRGBGRGRGRBRGRGBGRBRGBGBGRBRG

result:

ok ok

Subtask #2:

score: 7
Accepted

Test #31:

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

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

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

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

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

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #36:

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

input:

1 96
2 48
GRRGGRRGGRRGGGGGRRGRRGGGRRGRGGRRRGGRRRGGGGRGRGRGGRGGGGRGRGRRGRGGGRRRGGGRGRGGRGRGRRRRRRGRRGRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #37:

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

input:

1 44
2 22
GRRGGRRRRRRRRRRGRRGRRGRGGGGGGGGRGGGGRGRGRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #38:

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

input:

1 88
2 44
GGRRRRGRRGRGGGRGRGRRGRGGGRRGGRRRRGRRGRGRGRRRRGRRRGRRGRRGRRRRGRGGGRRRGRGRGRGGGGGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #39:

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

input:

1 29
2 14
RGGGGRGRRGRRRRGRRRRGRGRGRRRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #40:

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

input:

1 25
2 12
RRGGGGRRRRGGGGRGRRGGGRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #41:

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

input:

1 73
2 36
RRGGRGGRGRRRRRGGRRGGRGRGGRGGGRGRGGGRRRGGRRGRRRRRRGGGRGGGGGGRGRGGGRRRRGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #42:

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

input:

1 22
2 11
RGRRGGGRGGRRGGGRRGRGRR

output:

RGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #43:

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

input:

1 66
2 33
GGRGGGRGRGRGRGRRRRRGGRRRGRGGRGGGGRRRGGGRRGRRGRRGRRRGRRGGGRRRRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #44:

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

input:

1 10
2 5
GRGRRGRGRG

output:

RGRGRGRGRG

result:

ok ok

Test #45:

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

input:

1 51
2 25
GRGGGGGGGRGGRGGRRGGRGRRRGRRRRRGGRRRRGGRGRGGGRRRGGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #46:

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

input:

1 99
2 49
RRRGRGRGGRGGGRGGRRRRGGGRRGGRRRRRGRRGRGGRGRRRRRRGGRGRGGGRRRRGGGGGRGGRRRRRGRGGGRGRRGGGGGRGRGGGRGRRGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #47:

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

input:

1 39
2 19
RGRRRGRRGRGRRGRGRGGRRRRGRRGRRRRRRRGRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #48:

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

input:

1 92
2 46
RGRGGGGRRGRGGRRGRRGGGRGGGGGGRGGRGRGGGGGGGGRRGRRGRGRGGRGGRGRGGGRRRRGRRGRGGRRRGRRGGGRGRRRRRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #49:

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

input:

1 36
2 18
GGGRRGGRRGRRRGRGRRRGGGRGRRRGGGRGGGGG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #50:

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

input:

1 15
2 7
GRRGGRGRGRRRGGG

output:

GRGRGRGRGRGRGRG

result:

ok ok

Test #51:

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

input:

1 59
2 29
RRGRGRGRRRGGRRGGGRGGRGGGGRGGGRRGRRRGGGRRGGRGGGGGGGRRRGGGRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #52:

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

input:

1 99
2 49
RRGGRRRGRRGGGGRGGGGGGRRGRGRGGRGGGRRRRRGRRRRGRGGRGGGRRRRRGGRGGGGGRRGGRGGGRRGGGRGGRGRGGRRGRRGGGRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #53:

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

input:

1 52
2 26
RGGRGRGGGGGRRRRRGRRGGGGGGRRRGRRGRRRGRGRGGRGGRGGRRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #54:

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

input:

1 96
2 48
GGRRGRGGGGGGGGRRGGGGRRRRGGRRGGGRGRRRGGRGRGRRRGGGRGRGGRGRRGRRRGGRGGRGRRGRGRGGGRRRRRRGRGRRRGGGGRRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #55:

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

input:

1 40
2 20
GGRGRRRRGGRRRRGRGGGRGRGRRRGRGGRRGGGGGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #56:

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

input:

1 85
2 42
GRGRGRRRRRRRGGGRGRRRGGRRGGGGRRGRRGGRGGRRRRGGGGGRRRRRGGGRRRGRRGGRGGRGGRGRGRRRRGGRGRRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #57:

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

input:

1 25
2 12
RRGGRRGRRRRGRRRRGGRRRRGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #58:

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

input:

1 70
2 35
RGRRRRGRGRGRGRRGGRGRGGRGGRRGRRRGRGGRRRGGRGGGRGGRGRGRGRGRRRGRRRRGGRRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #59:

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

input:

1 26
2 13
RGRRGRRGGGGGRGGGRRGGGGGGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #60:

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

input:

1 100
2 50
GGGRRGRRRGGGRGGRRGRRGGRRGRGGRGRGGGRRRRRRRGRGRRRGRRRGRGRGGRRRRGGGGGRRGGRGRGGGRGGRRGRGRGRGGRGGRRRGRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Subtask #3:

score: 3
Accepted

Test #61:

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

input:

79 100
3 7900
RRRRBBGGGRGRGRGRGGGGRBBRRRGBRGRGRBBRGGBRRBBRGRGRBBBRGRBBRBBBRGGBGGRBGBBGGGBRGBRRGBBBGGGGRGGGRGRGBBGG
RGBRBGGGGGRBGRGBGGBGRB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GRGRGRGRGRBRG
RGBGBGRBRGBGRGRGRBRGBGRGRGRG...

result:

ok ok

Test #65:

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

input:

79 74
3 5846
RRGRGRBBRRBRGBRRGBRGRRBRBGGGRRBRGGGGRRBBBRBRRGGRRBRBRBRGBBBGRGGGBBBGBBRBBG
RRRBRBGBGBRRGRGRRRRRGBGRGBGBBRGGBBRRRBGBBGBGRRGRGGGRRGBRRRGBGRGRBGGGGGBGBR
GBBRBGBGRRGBGGBBRRBBBGGBBRBBGBGGRGBRGGRBRGRRRRGGRGGGBGRBGRRBBBBBGRGRGRBRBG
GGRGGRBRBRRRGGBRRBGRGGBBBBGGBBRBBGBRGBGBGGGGGRBBBRBRGRBBGRBRBR...

output:

RGRGRGBGRGBGRBRGRBRGRGBGBGRGRGBGRGRGRGBGBGBGRGRGRBRBRBRGBGBGRGRGBGBGBGRGBG
GRGBGBGBGBGRGRGRGRGRGBGRGBGBGRGRGBGRGBGBGRGRGRGRGRGRGRBRGRGBGRGRGRGRGRGRGR
RGBGBGBGRGRBRGBGRGBGBGRGBGBGRGRGRGBGRGRGRGRGRGRGRGRGBGRGRGRGBGBGRGRGRGBGBG
GRGRGRGRGRGRGRGRGBGRGRGBGBGRGBGBGRGRGBGBGRGRGRGBGRBRGRGBGRBRGRGBGRGRGBGRGR
...

result:

ok ok

Test #66:

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

input:

3 26
3 78
BGRBBRGRRGGGRGRRRRBBGBRBRG
RRBRBBBGRBBBBRRBRGRRBRGRBR
RBGRGBBBRRRBRBBRBBBRRBGGGB

output:

BGRGBGRGRGRGRGRGRGBGRBRBRG
GRBRGBGRGBGBGRGBGRGRBRGRBR
RBRGRGBGRGRGRGBGBGBGRBRGRB

result:

ok ok

Test #67:

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

input:

31 71
3 2201
RBGRRBGRRGRRRGBBGRBRRGBRRRGBGGGGGGRGRRBRGRGGRGGBRBGBRRBRRBRGGGGRGB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GRGRGRGBGRG
...

result:

ok ok

Test #80:

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

input:

39 41
3 1599
RBBGBBBRRBRGGGBBGRGBBBBGBBRRRBBRBRRRBRRRR
BBBGBBGRBRBRBGBGGGRBGRBBBRBGGBRGRBBGRGBBG
RBBGRGBGGGBRGRBRRRRRRRBGRBBBBGGGBRGRGGRGG
BBRRBRBRGBRGBGGBBBRGRGBGBGGBBBBGRGBBGBRRG
GRGGRGBBRRRRBRBBGRRRGGBRGBBGBBGRGGBBRRGRR
BRRBGRRBGGGRGRRBRRGGBRGBBRBBGRGBBBGGRBBRR
RGRGBBGRGBRBGRGGRGRGBBRGGBBRRGGBRRR...

output:

RGBGBGBGRBRGRGBGRGRGBGBGBGRGRGBGBGRGBGRGR
GBGRGBGRBRGRBRGRGRGBGRGBGRGRGBGRGBGRGRGBG
RGBGRGBGRGBGRGBGRGRGRGBGRGBGBGRGBGRGRGRGR
GBGRBRGRGBGRGRGBGBGRGRGRBRGBGBGRGRGBGBGRG
RGRGRGBGRGRGBGBGRGRGRGBGRGBGBGRGRGBGRGRGR
BRGBGRGBGRGRGRGBGRGRGRGBGRGBGRGBGBGRGBGRG
RGRGBGRGRBRBRGRGRGRGBGRGRGBGRGRGRGRBRGRGR
GRGRGR...

result:

ok ok

Test #81:

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

input:

67 90
3 6030
GBGRBGBBBGRBRGRRRRBRBGGRGGGRBBBBGBRBRRBRBRGRGGBRBRRBRGGBGRBBBRBGRGBBRGRRRGRRGGGGGBGGRGRGBB
BRGRRBRRBBBBGGBBBRBRGRGBGBRGBRBGGGBBRGGBRBGRBBGGRRBRBBGRGBBRGRRRRBGRBGBRGGGGRBGGGBGGRRRBGR
RBRRRBBGRRRGRBGRBRBGRRGRGBGRGRRGBBRBGRRRGGRGRGGBGRGRGGRBGBRBRBRRRGBGRBRGBBRBRRGBRBRRRBGBGB
GBRGGRRBBGBGRB...

output:

GBGRBRGBGRGBGRGRGRGR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GBGRGBGRGRGBGBGB
GBGRGRGRGBGBGBGBGRGRGRGBGRGRGRGRGRGBGRGRBRGRGBGBG
RGRBRGRGRGRGBGRGRGBGRGRGRGRGRGRGRGBGRGRGRBRGRGRGR
GRGRGBGBGRGRGRGRGRGBGBGRGBGRGRGBGRGRGRBRGRGRGBGRG
...

result:

ok ok

Test #90:

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

input:

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

output:

GBGRBRGRGRGRGBGRGRGBGRBRGBG
RGBGRGBGRGBGRGRGRGBGRGRGRGR
GRGRGBGRGRGBGBGBGBGBGRGBGRG
RGRGRGRGBGRGBGBGRGBGRGRGBGR
GBGRGRGBGBGBGRGRGRGBGRGRGRB
RGRGRGRGBGRGRGBGBGRGBGBGBGR
GBGBGBGRGBGRGBGBGBGRGBGBGRG
RGBGBGBGRGBGRGRGRGBGBGBGRGR
BRGBGRGBGRGBGRGRGRGBGRGBGBG
RBRGBGRGRGBGRGBGRGRGRGRGRGB
GRGRGRGBGBGRGRGRGBGR...

result:

ok ok

Subtask #4:

score: 0
Wrong Answer

Test #91:

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

input:

8 69
3 276
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRBRG
RGRBGRBRBRBRBGBRBRBRGRBRGRGRGRGRBRBGBRBGBGRBRGBGRBGBRGRGBRBGBGBGBRB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RG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGR...

result:

ok ok

Test #93:

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

input:

4 5
3 10
RGRBG
RGRBG
RGRBG
RGRBG

output:

RGRGR
GRGBG
RGRGR
GRGBG

result:

ok ok

Test #94:

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

input:

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

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGRGBGBGB
GBGRGRGBGRGBGBGBGBGRGRGBGBGRGBGBGRGRGRGRGBGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGRGBGBGB
GBGRGRGBGRGBGBGBGBGRGRGBGBGRGBGBGRGRGRGRGBGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGRGBGBGB
GBGRGRGBGRGBGBGBGBGRGRGBGBGRGBGBGRGRGRGRGBGRGRGRG
...

result:

ok ok

Test #95:

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

input:

52 94
3 2444
RGRGRBRGBRBRGRBGRGBRBRBGBRBRGRGRBRGRBRBRBGRGBGBRGRGRGBGBRGRGBGRBGBRGRBRGBGBGRBGBGBRBRGRGRGRGRB
RGRGRBRGBRBRGRBGRGBRBRBGBRBRGRGRBRGRBRBRBGRGBGBR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b

input:

75 80
3 3000
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBG...

output:

GBGBGRGRGRGRGRGRGBGBGRGRGBGBGBGRGRGRGRGRGRGRGRGRGBGRGRGRGBGBGRGBGBGBGBGBGRGRGRGB
RGRGRGRGBGBGBGBGRGRGRGBGRGRGRGRGBGRGRGRGRGBGBGBGRGRGBGBGRGRGRGRGRGRGRGRGRGRGBGRG
GBGBGRGRGRGRGRGRGBGBGRGRGBGBGBGRGRGRGRGRGRGRGRGRGBGRGRGRGBGBGRGBGBGBGBGBGRGRGRGB
RGRGRGRGBGBGBGBGRGRGRGBGRGRGRGRGBGRGRGRGRGBGBGBGRGRGBGBGR...

result:

ok ok

Test #106:

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

input:

3 24
3 36
GRGBRBGBGRGBGBRGBRGBRBGB
GRGBRBGBGRGBGBRGBRGBRBGB
GRGBRBGBGRGBGBRGBRGBRBGB

output:

GRGBGBGBGRGBGBGRGRGBGBGB
RGRGRGRGRGRGRGRGBGRGRGRG
GRGBGBGBGRGBGBGRGRGBGBGB

result:

ok ok

Test #107:

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

input:

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

output:

GRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGRGRGRGRGRGRGRGRGRGBGRGRGRGRGRGR
RGBGRGRGRGBGRGBGBGBGRGRGBGRGRGRGRGBGBGRGRGBGBGRGBGRGRGBGBGBGBGBG
GRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGRGRGRGRGRGRGRGRGRGBGRGRGRGRGRGR
RGBGRGRGRGBGRGBGBGBGRGRGBGRGRGRGRGBGBGRGRGBGBGRGBGRGRGBGBGBGBGBG
GRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGRGRGRGR...

result:

wrong answer can change at most Q positions

Subtask #5:

score: 7
Accepted

Test #121:

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

input:

9 68
3 306
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBR...

output:

RGRGRGBGRGRGRGRGBGRGBGRGBGRGRGBGRGBGRGBGRGRGBGRGRGBGRGBGBGRGRGBGBGBG
GBGBGRGRGRGBGRGRGBGRGRGBGBGBGBGRGRGRGRGBGBGRGBGRGRGRGBGRGBGRGRGRGRGR
RGRGRGBGRGRGRGRGBGRGBGRGBGRGRGBGRGBGRGBGRGRGBGRGRGBGRGBGBGRGRGBGBGBG
GBGBGRGR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BGRGBGBGRGBGRGRGRGRGR

result:

ok ok

Test #133:

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

input:

36 93
3 1674
RRGRRBGGRRRRRBGRRRBRRRGRBRGRRGGBBBRRBGGGRBRBBGBRGGBRBRRGGBBGGGRGGRBBRBGBRRBGRBBRGGGGGGGGBBGRR
RRGRRBGGRRRRRBGRRRBRRRGRBRGRRGGBBBRRBGGGRBRBBGBRGGBRBRRGGBBGGGRGGRBBRBGBRRBGRBBRGGGGGGGGBBGRR
RRGRRBGGRRRRRBGRRRBRRRGRBRGRRGGBBBRRBGGGRBRBBGBRGGBRBRRGGBBGGGRGGRBBRBGBRRBGRBBRGGGGGGGGBBGRR
RRGRR...

output:

RGRGRGRGRGRGRGRGRGBGRGRGBGRGRGRGBGRGBGRGRGRGBGBGRGBGBGRGRGBGRGRGRGBGRGRGRGBGRGBGRGRGRGRGBGRGR
GRGRGBGRGRGRGBGRGRGRGRGRGRGRGRGBGBGRGRGRGBGBGRGRGRGRGRGRGBGRGRGRGRGBGBGBGRGRGBGRGRGRGRGRGBGRG
RGRGRGRGRGRGRGRGRGBGRGRGBGRGRGRGBGRGBGRGRGRGBGBGRGBGBGRGRGBGRGRGRGBGRGRGRGBGRGBGRGRGRGRGBGRGR
GRGRGBGRGRGRGBGRGR...

result:

ok ok

Test #134:

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

input:

64 33
3 1056
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBBGGRRGRBRGGGRGRRBGB
RBBGRRGRGBBRGBB...

output:

RGBGRGRGRGBG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GRGRGBGRGRGBGRGRGRGBGBGRGBGB...

result:

ok ok

Test #141:

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

input:

98 82
3 4018
GGRBRBRRRRGBBBBGBBGBBBBRRRRGRRBGGBRRGBRRGGBGGGBGGRRBBGBRBBBGGRGRBBRGRBRBRRGBBBGBGR
GGRBRBRRRRGBBBBGBBGBBBBRRRRGRRBGGBRRGBRRGGBGGGBGGRRBBGBRBBBGGRGRBBRGRBRBRRGBBBGBGR
GGRBRBRRRRGBBBBGBBGBBBBRRRRGRRBGGBRRGBRRGGBGGGBGGRRBBGBRBBBGGRGRBBRGRBRBRRGBBBGBGR
GGRBRBRRRRGBBBBGBBGBBBBRRRRGRRBGGBRRGB...

output:

RGRGRGRGRGRGBGBGBGRGBGBGRGRGRGBGRGRGRGRGRGBGRGBGRGRGBGBGBGBGRGRGBGRGRGRGRGRGBGRGRG
GRGBGBGRGRGBGBGRGBGBGBGRGRGRGRGRGBGRGBGRGRGRGRGRGRGBGRGRGBGRGRGRGBGRGBGBGRGBGBGBGR
RGRGRGRGRGRGBGBGBGRGBGBGRGRGRGBGRGRGRGRGRGBGRGBGRGRGBGBGBGBGRGRGBGRGRGRGRGRGBGRGRG
GRGBGBGRGRGBGBGRGBGBGBGRGRGRGRGRGBGRGBGRGRGRGRGRGRG...

result:

ok ok

Test #142:

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

input:

22 26
3 286
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRBGBGBGGRG
GBGRGBGRGRBBGBRRRB...

output:

RGRG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GRGBGBG
RGRGRGBGBGRGBGRGBGRGRGRGRGR
GRGBGBGRGRGBGRGBGRGRGRGBGBG
RGRGRGBGBGRGBGRGBGRGRGRGRGR
GRGBGBGRGRGBGRGBGRGRGRGBGBG
RGRGRGBGBGRGBGRGBGRGRGRGRGR
GRGBGBGRGRGBGRGBGRGR...

result:

ok ok

Subtask #6:

score: 13
Accepted

Test #151:

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

input:

4 10
3 26
BGGRRBBRBG
BGBGGBGRRB
RBBBBBRGGR
RGRBGGRGBB

output:

GRGRGBGRBR
BGBGRGRGRB
GBGBGBGRGR
RGRGRGRGBG

result:

ok ok

Test #152:

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

input:

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

output:

GBGBGBGRGRGRGRGRBRGBGRGRGRGRBRBRGRGRGRGRGRGRGRGRGRGRGRG
BGRGRGBGBGBGRGRGRBRGBGRGBGRGRBRGRGBGBGRGRGRGBGBGBGBGRGR
GRGBGBGRGRGRGRGRGRGBGRGRGRGRGRGRGRGBGRGBGBGRGRGRGRGBGRG
RBRGRGBGRBRGBGBGBGRGRGBGBGBGBGBGRGBGRGBGRGRGRGRGRGRGRGB
GRGBGRGBGRGRGRGRGRGRGBGRGRGBGRGRGRGBGRGBGRBRGBGRGRGRGRG
RGBGBGRGRGRBRGRGRGRG...

result:

ok ok

Test #153:

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

input:

60 99
3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...

result:

ok ok

Test #161:

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

input:

74 20
3 986
GRGBBRRRBGGRRRRBBGRR
GBRRBRBRRRGRGRGGRGRB
BRRRRBGGGGRBGRRBGBRR
RBBBGRBBBBGBRRBRGRRB
GGBRRBRGBGRRGRBBRRGB
GGGRBGBGBBGBGRRGRRRG
RBRRRRRBRBGRGGGBBRBR
BRRBBGBRRBRGRBGRBBRB
RRRBRGRRRGBGRGGGGBRG
GGBGGRBBRRRBRGRBBRBR
GRRRRRRBGGRRRGBRBRRB
GRRRGBGRBGGGGBBBGGGG
RBBBGBRBRBBGRBGRBRRB
GGGGGBBBBRGRGBR...

output:

RGRGBGRGBGRGRGRGBGRG
GBGRGRBRGRGRGRGRGRGB
BGRGRBRGRGRGRGRBRBRG
GBGBGRGBGBGBGRGRGRGB
RGBGRBRGBGRGRGBGRGRG
GRGRBRBRGBGBGRGRGRGR
RBRGRGRBRGRGRGRGBGBG
BRGBGRBRGBGRGBGRGBGB
RGRGRGRGRGBGRGRGRGRG
GRBRGRGBGRGBGRGBGRBR
RGRGRGRGRGRGRGBGBGRB
GRGRGBGRBRGRGBGBGRGR
RGBGRGRGRGBGRGRGBGRB
GRGRGBGBGRGRGBGRGRBR
RBRGRG...

result:

ok ok

Test #162:

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

input:

98 64
3 4181
RGRRGGGBBRBGBRGGRRRGGRGGGGRGRGBBRRGGBGBRRBGGBGGGRRRGGGBGRGGBRRBG
BGGRBRGGGGRBGRBRBBGGRBBBBRBBBGGBBBGRRRRGGRBBRGGGGGRBRBGRRGGGRBBB
BBGBRGBBGRBGBBGBRGBRGGGGBBRRRRGBRGRGGGBGRRGRBBBRGGGBRBGBBRGBRGRG
BRBGRGRBRRGRGGGRGBRBBBBRGBRRBRGGBBRBGBBBRGGBGRBRGRRBRRGGGBGBRRRR
RBBGGBGGGBRGBGGBRRGRRRBGGBB...

output:

GRGRGRGBGRBRBRGRGRGRGRGRGRGRGRGB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GRGBGBGR
RGR...

result:

ok ok

Test #174:

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

input:

65 38
3 1646
BBGBGGRRBGRRBGRGRBGRGBBRGBBGGBGGRGGRRB
GBBBGBGGBBRBBBBBBGRBGRBBRBBBRGGRGBRBGR
RBRGGRBRBGBRRRGRGRGGGBRBBGBBGBRRGRRRRG
RGGBRGBBGGBBBRRRRRBGGBRRGRBRBGBRGGRGRB
BGBBRBGBGRRGGRRBBRGGRRRRRBGRGRGGBGGGRB
RGGGBBRRRBBRBBGBGGBGGRGRBBBGBRGRBBRBBG
GGRBBBBBGRRGBGBGRGGBGGGGRBGRGGRBBRRRGG
BRGBBRRBRRGGGG...

output:

GBGBGRGRGRGRGRGRGBGRGBGRGBGRGBGRGRGRGB
RGBGRBRGBGRGBGBGBGRBRGBGRGBGRGRGRBRBRG
GBGRGRGRGRGRGRGRGRGRGBGBGRGBGBGRGRGRGR
RGRGRGBGRGBGBGRGRGBGRGRGRGBGBGBGRGRGRG
BRGBGBGBGRGRGRGBGRGRGRGRGBGRGRGRGRGRGB
RGRGBGRGRGBGBGRGRGBGRGRGBGBGBGRGBGRGBG
GRGBGBGBGRGRGRBRGRGBGRGRGBGRGRGBGRGRGR
BGRGBGRGRGRGRGRGBGRGBGRBRGR...

result:

ok ok

Test #175:

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

input:

89 83
3 4924
BGRRBBBBGBBGRGRRBGBBRBRBGGGGGRGBGGBBBBBGBGGGRBRBGRRGBRRGBGBBRBBBGBGRBBGGGRBBGBRBBRR
GGGBGRRRBRBGRGGRGGGRBBGGRBBRGBGBGGRGBRRGRRBRGGRRBRRGRGBBBGRGGGBGGBGBBGGBBRRBRGRRGGB
BGRBRGBBRBGBRRGGRGRRRGGBGGBRRRBGRGGGRRBGBGRRBGRBGRGRGGRBBBBRGBGBGBGGRGBRRRBBGBRGRRB
RGGBRRGRGBBGBGRGBGGBGBGBRGBBBBBGBGB...

output:

BRGRGBGBGBGRGRGRBRGB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RBBBGGRRBBBGGRRGGBBBGGRBBGRBGRRGBGRRG
GGGBGBRGRGBBRGRGBGGGBBGBBGRBRGGRGBGGBBRRGRRBRBG
GGRGRBRRBBRGBGGRBGRBRGBRRRRGBGGGBGGRBRGGRBRGBGR...

output:

BGRGBGRGBGRGBGRGRBRGRGRGBGRGBGBGRGRGBGBGRGBGRBR
GRGRGRGRGBGRGBGRGRGRGRBRGRGBGBGRGRGRGBGBGRGRBRG
RGRGBGBGRGBGRGBGRBRGRGRBRGRGBGBGRGBGRGRGRGRGRGR
GRGBGRGBGBGBGBGRGRGBGRGRGRGBGBGRGBGRGBGRGRBRGRG
RGRGRGRGRGBGRGRGBGRGBGRGBGRGRGRGRGRGBGRGRGRBRBR
GRGRGBGRGBGRBRGRGRGBGRBRGRGRBRGRBRGRGRGRGBGRGRG
BGRGBGRGBGBG...

result:

ok ok

Subtask #7:

score: 19
Accepted

Test #181:

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

input:

4 52
3 104
GRRGGGGBGRRBRGBRGRGRRBGBGBBRGGRRBBGBGBGBGGBRRRRBRRRG
RGBGGGRGBGRBGRRBBBBRGRRBBBBGGBRGRBBRGGRBRGBRBGRBBGGR
RBRGBGBGGRBBGGGRRRRBBRGRRGGBRGGRGRRGBRRRGRRBRGRGRBGG
GRBBRRRRGGBRBBBGBBGGBRRGRGGBGGBRRGBRBBRRBGGBGBBBRRRR

output:

GRGRGRGBGRGBGRBRGRGRGBGBGBGRGRGRGBGBGBGBGRGRGRGBGRGR
RGBGRGRGBGRGRGRGBGBGRGRGBGBGRBRGRGBGRGRGRGBGBGRGBGRG
GBGRBRBRGRGBGRGRGRGBGRGRGRGBGRGRGRGRGRGRGRGBGRGRGBGR
RGBGRGRGRGBGBGBGBGRGBGRGRGRGRGBGRGBGBGRGBGRGRGBGRGRG

result:

ok ok

Test #182:

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

input:

3 4
3 6
RRRR
GBGR
RRGB

output:

RGRG
GBGR
RGRB

result:

ok ok

Test #183:

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

input:

1 48
3 24
BBGBBRRGGBBRRGRBBBBBRRGBGBRRGGBGRGBBBRRRRRRRGRGB

output:

GBGBGRGRGBGRGRGBGBGBGRGBGBGRGRBRGRGBGRGRGRGRGRGB

result:

ok ok

Test #184:

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

input:

4 93
3 186
RRBRRBGRBBGGGGGGBRGGRBRGGRBRGRBGBRGGRRGGBBRRBBRGGRRBGRGGBRRRBGRBGBGBBRRBBBRBBGBGBBBRBGBBRGGBB
RBRRRBGBRBRGGRRGBGRGBBBBGGBRGBGGGGGBRBRRGGBRRBBGRBBGBGGGGGRBBGBGGBGGRRBBBBRGRGGBRBRRRGGRGRGRB
BGBGGBRGGBGGBRGRGGBBGBGRGRGRGBBGBBRGBRBBRRGBGRGGBRRGGRRGBGGGRRGGRBGGBRBGBBBGBBGRRBBRBRRRRGRRG
BBBGBGB...

output:

GRBRGBGRGBGRGRGRGRGRGBGRGRGRGRBRBRGRGRGRGBGRGBGRGRGBGRGRBRGRGRGBGBGBGRGBGBGBGRBRGBGRBRGBGRGBG
RBRGRGRBRGRGRGRGBGRGBGBGRGBGRGRGRGRBRBRGRGBGRGBGRGBGBGRGRGRGBGBGRGRGRGBGBGRGRGRBRGRGRGRGRGRGB
GRGRGBGRGBGRBRGRGRGBGBGRGRGRGBGRGBGRBRGBGRGBGRGRBRGRGRGRBRGRGRGRGBGRGRGRGBGRGBGRGBGRBRGRGRGRG
BGBGBGBGRGRBRGRGRG...

result:

ok ok

Test #185:

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

input:

4 37
3 74
RGGBBRBRGGGBRGBBGBRGRRBBRGGBBGGBGGGRB
BRGRRGRGRRRRGRRBRRGRBGBRGGRGRGGGBGBRB
RBGRBRGRBBBRRBRRGGBBRBBGBBRGGRRBBGRRG
RGBBBRRBGRGRRGGBGRGGRGGRGGRBBGBGBBRGB

output:

GRGBGRBRGRGBGRGBGBGRGRGBGRGBGRGBGRGRG
BGRGRGRGRGRGRGRGRGRGBGBGRGRGRGRGBGBGB
GBGRGRGRGBGRGBGRGRGBGBGRGBGRGRGBGRGRG
RGBGBGRBRGRGRGRBRGRGRGRGRGRGBGBGBGRGB

result:

ok ok

Test #186:

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

input:

2 77
3 77
GRGRGGRRBBBBGGBRRGGBRRRRBBRBGBGBBBRGGGGBGBGBBBGRGBBBGRGGGGRRBRGGRBRRBBRBGBBRR
GGRRBRRBBBBRBBRBBBGBBGGBBGGBRRBGRRBBGRBBBRGBBBRBRBBGGGRGRGBBBBGRBGRRBRRGRGRBB

output:

GRGRGRGRGBGBGRBRGRGBGRGRGBGBGBGBGBGRGRGBGBGBGBGRGBGBGRGRGRGRGRGRGBGRGBGBGBGRG
RGRGBGRGBGBGBGRGBGRGBGRGBGRGRGBGRGBGRGBGBGRGBGRBRGBGRGRGRGBGBGRGBGRGBGRGRGRGB

result:

ok ok

Test #187:

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

input:

1 22
3 11
RRGBGBGGGBBRRBRGBRGGRG

output:

RGRBRBRGRGBGRBRGBGRGRG

result:

ok ok

Test #188:

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

input:

4 74
3 148
RRBRBBBRBGGBGBBGGBRGRGRGGGGGRGBBBRRRGBBRGGRBBBBGRGRGGBRRBRRRRRBRGGBGRRBGGB
GBBRRGRGBGRRBBBRRBGRRBGGRBBGGGRRBGBGGBGBBRGBRBGGRRGRRBRGRRGGGBBRBRGBBBBBBB
GRRBBGBGBBGBBGRRGGGGBGBGRGRBBBGBBRGRBGRRGBRGRGGRBBBGBBGBGBGRRRGRRRRRBGGBGR
GGGGRBBRGRBGGGRRGGRRRBGGBBBBRGRGBGBGRGRBGGGRBBBBGRGRRRBBRGGGBBRG...

output:

GRGRGBGRGRGBGBGRGBGRGRGRGRGRGRGBGRGRGBGRGRGBGBGRGRGRGBGRBRGRGRGRGRBRGRGRGB
RGBGRGRGBGRGBGBGRGRGRBRGRGBGRGRGBGBGRGRGBGRGRGRGRGRGRGRGRGRGRGBGBGRGBGBGBG
GRGBGRGRGBGBGRGRGRGRBRBRGRGBGBGBGRGRBRGRGBGRGRGRGBGRGBGBGBGRGRGRGRGRGRGBGR
RGRGRGBGRGBGRGRGRGRGRBRGBGBGRGRGBGBGRGRBRGRGBGBGRGRGRGBGRGRGBGRGRGRGRGBGRG

result:

ok ok

Test #189:

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

input:

4 18
3 36
BGRBBGRRBRBRBBGBGR
BBRBBGRBBBBGGBBRGB
GGRRRBRBGRGRGRBGGR
BRRRGGGBGRBRGRRGRG

output:

GRGBGRGRGRGRGBGBGR
BGRGBGRGBGBGRGBGRB
GRGRGBGBGRGRGRGRGR
BGRGRGRGRGBGRGRGRG

result:

ok ok

Test #190:

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

input:

5 45
3 112
BGGBRRBGGGRBBGGRBGGRGGGRBBBBRGGBGBGBBGBRGBRBG
RRRRGRGRRGGGBGBGBBGBGGRBBGGRRRBRGGBGGBRGBRBRR
RBBBBGGRGRRBGBBRGBGGGBRBRRRBRGRRRGBGBGRBBBGBB
BBRRRGRBGRGRBBRBBGBBBBGRBGRGGBBBGRBBRGBGRBGRB
GGBGRBBGGGRBRBBBRRBGBRGGRBBRBGBRBGRBBGGBRGRGR

output:

BGRBRGBGRGRGBGRGBGRGRGRGBGBGRGRBRBRGBGBGRBRBR
GRGRGRGRGRGRGRGRGBGBGRGBGRGRGRBRGRGRGBGRGRBRG
RGBGBGRGRGRBRGBGRGRGRGRGRGRBRGRGRGBGBGRGBGRGB
GBGRGRGBGRGRGBGBGRGBGBGRBRGRGBGBGRGBGRBRGBGRG
RGBGRGBGRGRBRGBGRGBGBGRGRGBGBGBGBGRGBGRBRGRGR

result:

ok ok

Test #191:

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

input:

3 90
3 135
RGBRGRRRRBGBBBRGGRBRBBRBGBRGBGRRRGGGGRBGBBRBBBGGBBRGRRRBBGGBGBGBRGGGGBBBGBRGRBRBBGRBBRRBBB
BRBRBRGBRBBRBGRBBRGBGGBRRBGRBRRRGRRGBRGGGGBBGRBBGBRRRRBBGGGBRGGGBGRBGRBBGGRGBBGBRGBBGRBBGR
BBGRGRGBRBGRGBBGRBRGRRBGRRRGGGGRBBGGBBRBBRRRGRGRBGGBBRBRRGRRBBRBBGRRGRRRGGBGRBBGRBRRGBRGBR

output:

RGBGRGRGRGRGBGRGRGBGBGRBRGRGBGRGRGRGRGBGBGRGBGRGBGRGRGRGBGRGRBRBRGRGRGBGRBRGRGRGBGRGBGRGBG
GRGRBRGBGBGRGRGBGRGBGRGRGBGRGRGRGRGRGRGRGRGBGRGBGBGRGRGBGRGBGRGRGRGBGRGBGRGRGBGBGRGBGRGBGR
BGRGRGRGRGRGRGBGRBRGRGBGRGRGRGRGBGRGBGRGBGRGRGRGBGRGBGBGRGRGBGRGBGRGRGRGRGBGRGBGRBRGRBRGBG

result:

ok ok

Test #192:

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

input:

2 34
3 34
BRRBBBBBGGBBRBRGBRBGRRBGRGRGBGBRBG
BGBBRBRGRGRRRGGRGBBRGGBGRGBRRRRBRG

output:

BGRGBGBGRGBGRBRGBGBGRGBGRGRGBGBGBG
GRGBGBGRGRGRGRGRGBGRGRGRGRBRGRGBGR

result:

ok ok

Test #193:

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

input:

1 74
3 37
BBGRBRGBBBRBGBGRRRGGRRGBGRBGGGBGRGRBRBRGBBRGGBGGRRRGGRRGRGBRGBBBGRBRBRGRGB

output:

GBGRBRGBGBGBGBGRGRGRGRGBGRBRGRBRGRGBGBGRGBGRGBGRGRGRGRGRGRBRGBGBGRBRBRGRGB

result:

ok ok

Test #194:

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

input:

5 27
3 67
RGRRBRRGBBGBRGGRGBGBBBBGBBB
RGGGRBGGGRRBRRRRGRGGBRBRRBR
RGBRRGBGRRRRBBGRRRBBBBBGBGB
BRBRGGRRRGGGGRBRGBRGBGGBGGR
RGRGRBRBBRBGGBRBBGBBGGRGRBB

output:

RGRGBGRGBGRGRGRGRBRGBGBGBGB
GRGRGBGRGRGBGRGRGRGRGRGRGBG
RGBGRGBGRGRGBGRGRGBGBGBGBGB
BRGRGRGRGRGRGRBRGBGRGRGBGRG
RGRGRBRGBGBGRBRGBGBGRGRGRGB

result:

ok ok

Test #195:

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

input:

3 71
3 106
BBBBGBGRBRGBGGRBGGGBGGGRGGRGGGGBGRGGRRGBGGRRGBGBBGGBGRGGRRRRBGRRGGGRRRG
RRBBGRGGBGRBGGRBGRGGBGRBRGGGBRGBGRBGRBGBGRRRRBGBRBBGRBBBGBRGBGRGGGBGBRB
RRBGBRBBBBRBRGGRGGRBBGRRRRRGBBBBBGRRBRGGRBRBGBRBRBRGGBBBGGBBGGBRRGGGGGB

output:

GBGBGBGRGRGBGRGBGRGBGRGRGRGRGRGBGRGRGRGBGRGRGBGBGRGBGRGRGRGRGRGRGRGRGRG
RGBGRGRGBGRGRGRGRGRGBGRBRGRGBGRGRGBGRBRGRGRGRGRGRGBGRGBGRBRGBGRGRGBGBGB
GRGRBRGBGBGBGRGRGRGBGRGRGRGRGBGBGRGRBRGRGBGBGBGBGBGRGBGBGRGBGRBRGRGRGRG

result:

ok ok

Test #196:

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

input:

2 15
3 15
RRBGRBBBGGRBRBB
RRBBRRBRGGRGRRG

output:

RGBGRGBGRGRBRGB
GRGBGRGRGRGRGRG

result:

ok ok

Test #197:

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

input:

1 60
3 30
GBRBBRBBBGGRGBRGGBRRRGGBRRGGGGBRGBBGGRBGGGGRGRGGRBGRGRRRGBGG

output:

GBGBGRGBGRGRGBGRGBGRGRGBGRGRGRBRGBGRGRBRGRGRGRGRGBGRGRGRGBGR

result:

ok ok

Test #198:

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

input:

4 100
3 200
RGBBGGGBBGGRGBRBRRRRBBRGRBBRGRBRGGRRGBBBRBGRGGRBRRBGGBGBBBBRRRRBGBGGBGRRBGBBRRGGBGGBGRBBGGGRBRGRRBBB
RRGGGGGGBRBBRBRRBBRRGRRGRGGGGGBBGRGBBRGBRGRGRBGGGGBGGGBBGBGBRRGBBGRGBGGBBRRRBBGBRGGGBRGBGRGGBRBRGRGR
RGGGGRRRRGRBBGRRRRGGGBGRBGBGRBRBBGGRRRRRRGRGBRRRBBRRGBBBRBRRRGRGBRGGBRGGBBBRGRBGRBRRRB...

output:

RGBGRGRGBGRGRGRBRGRGBGRGRGBGRGBGRGRGRGBGRBRGRGRBRGBGRBRGBGBGRGRGRBRGBGRGBGBGRGRGBGRBRGBGRGRGBGRGRGBG
GRGRGRGRGRGBGBGRGBGRGRGRGRGRGRGBGRGBGRGBGRGRGBGRGRGRGRGBGBGBGRGBGRGRGRGBGRGRGBGBGRGRBRGBGRGRGRGRGRGR
RGRGRGRGRGRGBGRGRGRGRGRGBGBGRBRGBGRGRGRGRGRGBGRGBGRGRGBGRGRGRGRGBGRGBGRGBGBGRGBGRBRGRBRGRGBGBGBGRG...

result:

ok ok

Test #199:

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

input:

3 45
3 67
BGBBRBGRGRBBGBBGGRGRRBBBRBGBBBBGGBGGBBGBGRGRG
RRBRRRRGBBGBGRRGGBRGRGBGGRBBRGGBGGGGRGGBBGGGG
RRBBGGBRRRBGBGGBGGRGGGGGBRGRRBBBBBBGBBBGBBGGB

output:

BRGBGBGRGRGBGBGRGRGRGBGBGBGBGBGRGBGRGBGBGRGRG
RGBGRGRGBGRGRGRGRBRGRGBGRGBGRGRGRGRGRGRGBGRGR
GRGBGRBRGRBRBRGBGRGRGRGRBRGRGBGBGBGRGBGRGBGRB

result:

ok ok

Test #200:

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

input:

5 31
3 77
RBBRGRBBGBBGGBBRRBBBRRRBBRBGBGR
RGGRBBRBGGRBRGGBRRRGBBBBBGBRRBB
BBRRGGRGGRGBBRRRGGBGBGBRBRRRGGG
RBGGRBGBGRRRRRRRGRGBBRGRGRBBGRB
GBBGGBBGGGBBBGRBBBRGRBBBRBBGBGB

output:

RGBGRGBGRGBGRGBGRGBGRGRGBGBGBGR
GRGRGBGBGRGBGRGBGRGRGBGBGRGRGBG
BGRGRGRGRGRGBGRGRGBGBGBGBGRGRGR
GBGRGBGBGRGRGRGRGRGBGRGRGRGBGRG
RGBGRGBGRGBGBGRGBGRGRGBGRGBGBGB

result:

ok ok

Test #201:

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

input:

3 75
3 112
BRGGBGGBBBBRBRBGBGBRRBGGBRRRBRBBRGRBGBRRBRBGGBRRBBRGGRBRBGRRGRGRRRGBBBGRRBG
GGGGGBRRBGGBBGGRGBBGBRGGGGRRRGGRBGGGBRRGBBBRRRGGGBBBGBBGRBGBBRRGRBRBRGRBBGB
BBGBGGRGGGGGBGRRRGRGGGBRGRGGGRGRRGRGRBBRGGGBRGRGRRRBBGRBRGBBGGRGGRRRBRBGRGR

output:

BGRGBGRGBGBGBGBGBGBGRBRGBGRGBGBGRGRBRBRGBGBGRBRGBGRGRGBGBGRGRGRGRGRGBGRGRBR
GRGRGBGRGRGBGRGRGBGRBRGRGRGRGRGRBRGRBRGRGBGRGRGRGBGBGBGRGBGBGRGRGBGBGRGBGRB
BGRBRGRGRGRGBGRGRGRGRGBGRGRGRGRGRGRGRGBGRGRBRGRGRGRGBGRBRGBGRGRGRGRGBGBGRGR

result:

ok ok

Test #202:

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

input:

2 16
3 16
GGGRBBGBRBGBRRGR
GBRRRGRRGGRGGGGR

output:

GRGRGBGBGBGBGRGR
RBRGRGRGRGRGRGRG

result:

ok ok

Test #203:

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

input:

1 64
3 32
RRBGRRRRRBRGBGRGRBRGBRBBRGGRGGRRRRBRRRRGBRRRGBRGRRRBBGGRBRGBGRBR

output:

RGBGRGRGRBRGBGRGRBRGBGBGRGRGRGRGRGBGRGRGBGRGRBRGRGRGBGRGBGRBRGBG

result:

ok ok

Test #204:

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

input:

5 8
3 20
RGRBRRRB
BGRBRGGB
GBGGRGGR
GRBBBRRG
BBBBRBGG

output:

RGRGRGRG
BRGBGRGB
RBRGRGRG
GRGBGRGR
BGBGRBRG

result:

ok ok

Test #205:

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

input:

3 49
3 73
BGBBGBRBGBGBBGGRBRBBRGBGGGBBRGRRGRBBBRGBBBRBGBRBG
GRBGGRBRRRGBRGGBRGRBBBBBBGGBGRBBGGRRRRGRRRRGRGRBR
GGGRRGGRBRGGBBBBBBBGGRGGBRGGBRRRGBRGGGBRGGBGGBGRG

output:

BRGBGBGBGBGBGRGRBRGBGRGRGRGBGRGRGRGBGRGBGBGBGBGBG
RGBGRGBGRGRGRGRGRGRGBGBGBGRGRGBGRGRGRGRGRGRGRGRGR
GRGRGRGRBRGRGBGBGBGRGRGRGRGRBRGRGBGRGRBRGRBRGBGRG

result:

ok ok

Test #206:

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

input:

3 1
3 1
G
B
R

output:

R
B
R

result:

ok ok

Test #207:

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

input:

1 42
3 21
BRBGBRBRRGBBBGRRRGRBGBBBRGGGBRRGGBBRBBBRGB

output:

BGBGBGBGRGBGBGRGRGRBRGBGRGRGBGRGRGBGBGBGRB

result:

ok ok

Test #208:

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

input:

4 90
3 180
GGGRRBRRGGRBGGRGGRRRGRRRBBBRBGRRBGBBRGGRBRBBGGGRBBRBBGRGRGRGGBGRBRBGGGRRBBGBBRGGGRGBGBGBGR
RRBGGBGGGBBBRRGBBBBBRGGRBGRRBBRGBBRRBBGRRBRBBRRGRRGRRGRBBGGGBRGGRGGGGRGBGBBGBRBRRGGGRGBGRB
GBGGGRBBGRGRRRRBRBBGBRRGGRBBRGBGGGRBRRRGRRGGBGBBGBBGGRGGBGGGBBGRRRRGRRRGRRRGRRBBGRBGGGBRGR
RBBRRBBGBRRBRBGR...

output:

GRGRGBGRGRGBGRGRGRGRGRGRGBGRGRGRGRGBGRGRBRGBGRGRGBGBGRGRGRGRGBGRBRBRGRGRGBGBGRGRGRGBGBGBGR
RGBGRGRGRGBGRGRGBGBGRGRGBGRGBGRGBGRGBGRGRBRGBGRGRGRGRGRGBGRGBGRGRGRGRGRBRGBGBGBGRGRGRGBGRB
GBGRGRGBGRGRGRGBGBGRGRGRGRGBGRBRGRGBGRGRGRGRGRGBGBGRGRGRGRGRGBGRGRGRGRGRGRGRGRGBGRGRGRGRGR
RGBGRGBGBGRBRBRGRGRGBGRBRGB...

result:

ok ok

Test #209:

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

input:

3 34
3 51
GRGRRBGBRRGBRGRRBBBBBRBBGGRRGGBRBG
RGRRGGGBRRRGGBGRGGBBRGRGGRRBBRRGBB
GBBRRBBRRRGBRRGBGBRRGRGGBRRGRRGGGG

output:

GRGRGBGBGRGBGRGRGBGBGRGBGRGRGRBRGR
RGRGRGRGRGRGRBRGRGBGRGRGRGRGBGRGBG
GBGRGBGRGRGBGRGBGBGRGRGRBRGRGRGRGR

result:

ok ok

Test #210:

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

input:

4 9
3 18
GRRGBGRRB
RGGRGGGBB
GGRGRGGBB
BRRBBBRGR

output:

RGRGBGRGB
GRGRGRGBG
RGRGRGRGB
BRGBGBGRG

result:

ok ok

Subtask #8:

score: 17
Accepted

Test #211:

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

input:

42 54
2 1134
GGRRGGGGGGGGRRGGRRRGGGRRGRRGGGGGGRRGGGGGGGGGGRGGRRRGRG
RRRGGGRGGGRRRGGRRRRRRGGRGRGRGGRGGGRGRGRRGRRGGRGRRGGRRR
RGGGRGRGGGRGGGGGRGGRGRGGG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RGRGRGRG
RGRGRGRGR
...

result:

ok ok

Test #224:

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

input:

4 57
2 114
RGGRRRGGRRGRGRGGGGRRRRGGRRGRRRGRRGRRGGGGRRRGGRGGRRRGRRGRG
GGRGRGGGGRGGRGGGGGRRGGRRGGGGRGGRGRRRRGGGGGGGRRRRGGGGRGGRR
GGGGRGGRRGGRRRGGGRGRRGGGGGRRRGRRGGRRGGRGRGRGRRRRRRGRGRRGR
GRRGRGRRGRGGGRGGRRRGGRGRGRRRGRRRGGGRRGRRRGGGRGGRRRGGRGGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #225:

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

input:

24 6
2 72
RRRRGR
GGGRGG
RGRGGR
GGGGRG
GGRRGG
RRGGRG
GRRGGR
GRGRGR
RRGGRR
RGRGRG
RRRGRR
RGRGRG
RGRGGG
RRRGRG
GGGRRR
RGGRGG
GGRGRG
RRRRRR
RGRRRG
GGRGGR
GRRGGR
RRRGRR
GRGRRR
GGGGGG

output:

GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG
GRGRGR
RGRGRG

result:

ok ok

Test #226:

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

input:

52 50
2 1300
RRRGRRRGGGGRGRRGGRGGGRGGGRRGGGGRGGGRRRGRRRG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GRGRGRGRGRGRGRGRGRG...

result:

ok ok

Subtask #9:

score: 20
Accepted

Test #241:

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

input:

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

output:

GRBRGRGBGBGRGRG
RBRGRGBGBGBGBGR
GRGRGBGBGRGRGBG
BGRGRGRGRBRBRGR
GRGBGBGBGRGRGRB
RGRGRGRGRGRGRBR
GBGRGBGRGRGRGRG
RGRGRGRGRGRGRGB
GRBRGBGBGRBRGBG
RGRGBGBGRGRGRGB
BRGRGRGRGRBRGBG
RGRGBGBGRGRGBGB
GBGRGBGBGBGRGBG
BGBGRGBGRGBGRGB
GBGRGBGBGRGBGBG
BGRGBGRGRGRGRGR
GRGBGBGRGBGBGRG
RGRGRGRGRGBGRGB
GRGBGBGRGRGB...

result:

ok ok

Test #242:

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

input:

88 67
3 2948
RRBRGRGBRBRGGGRRGRGRRGRBRGGGRRRRGGRGRRGGRRGGGRRBRBBRBGRRRBRRRGGRBBB
RGGGBBBGBBRGRRBBBBGRBBGBGBBRRGBBRRGBGBBGBBGGRGGRRRBGBRRBGRGGGBRRRGB
BRGBRBRBBGBRGBRRRRGGBGRGRRRRBGGBGBBRBGRBBRGRBGRGGRBGRRRRGRBBRRRGRRR
RGBGBBBGGRGGBGBBBGBBBGRBRGBBRRBGBBGBRBBRBGRRRGRRRBRGBGGBGRGGGGGGGBB
BRBBGRBRGRRRGRB...

output:

GRBRGRGBGBGRGRGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGRGBGBGRGRGRGBGRGRGRGBG
RGRGBGBGBGRGRGBGBGRGBGRGRGBGRGBGRGRBRGBGBGRGRGRGRGBGBGRBRGRGRBRGRGB
BRGBGBGBGRBRGBGRGRGRGRGRGRGRBRGBGBGRBRGBGRGRBRGRGRGRGRGRGRGBGRGRGRG
RGBGBGBGRGRGBGBGBGBGBGRGRGBGRGBGBGRGRGBGBGRGRGRGRBRGBGRBRGRGRGRGRGB
BRGBGRGRGRGRGRGRGBGRGBGBGRGR...

result:

ok ok

Test #243:

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

input:

16 7
3 56
GGGGRRB
GBGBGGG
GBRRBBG
RGGBGBR
RBBBRRR
RGBRRRG
BGGGGGR
RRGGRGR
RGGRGGB
GGGGBRR
RBRRGGR
RRRRBRG
RBGBGGG
BGBBBRR
BRBBBRR
BRRBRRB

output:

RGRGRGB
GBGBGRG
RGRGBGR
GRGBGBG
RGBGRGR
GRGRGRG
BGRGRGR
GRGRGRG
RGRGRGB
GRGRBRG
RBRGRGR
GRGRBRG
RBRGRGR
GRGBGRG
BGBGBGR
GRGBGRB

result:

ok ok

Test #244:

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

input:

41 52
3 1066
BRBBBGBRGRGRGGGBBRRRGGBRGRBRBRGGGGBRGRRBBBBGGBRRGBBB
GGBBGGGBGGBGGGGGGGRBGBBRGBBBBRGBBGGBGRRBGGGGBBBGGBGG
BBGRGRBGGRGRRGBGBGGGBGRRBRGGRGBGGRRGBRGRGGRGBGGRGGGB
GRRGGGRRGBRGBGRRBRBBRBBGGBRRRRGRBRRRGGRGBBGGRGBBBGRR
RBGBRBRRBGGGGGBBBRGBGBBGGBGRRBRBBBRGRBGBBGGRGGGRGGRG
RGGRBBBRBBRBRGRBGBBGBB...

output:

BRGBGRBRGRGRGRGBGRGRGRGRGRGRGRGRGRBRGRGBGBGRGBGRGBGB
RGBGRGRBRG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RGRGRBRBRGBGRGBGR...

result:

ok ok

Test #251:

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

input:

98 74
3 3626
BBRRRBBRRGRBGRRGGRGGGGGGBBGBBGBGBGGRGBRRRBGRBBBBBBGGBRRBGGGBBGRGGGRGBBBGGG
BRGBBGRRBGGGRRBRGBRRBGBGGGBRRRRGGBGGBBGGGGRGGGRBBGGGBGGBBGBGRGRGGGGGBGGGRG
BGBBRBBGGRRGBGBGBGGGRGGRGRRRBRBBGBGGGGRRRRRGRBGBRBRRRRBRGBRRGBBBBBRBBGRGRR
GBRGGGBBBRGRRBBRGGBRGRGRGBGBGBRRRBBGRRGBBRRGBGBGRRBBBBBRGGBRGB...

output:

GBGRGBGRGRGBGRGRGRGRGRGRGBGBGRBRBRGRGBGRGBGRGBGBGBGRGRGBGRGBGRGRGRGRGBGRGR
BGRGBGRGBGRGRGBGRBRGBGBGRGBGRGRGRGRGBGRGRGRGRGRGBGRGBGRGBGBGRGRGRGRGBGRGRG
GRGBGBGRGRGRBRGRBRGRGRGRGRGRBRGBGBGRGRGRGRGRGBGBGBGRGRGRGBGRGBGBGBGBGRGRGR
RBRGRGBGBGRGRGBGRGBGRGRGRBRBRGRGRGBGRGRGBGRGBGBGRGBGBGBGRGBGRGBGRGRGBGRGRG
...

result:

ok ok

Test #252:

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

input:

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

output:

GRGRGRGRBRGRGRG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BGRRGRBRRRGBRRBBRGBGRB...

output:

BGBGBGBGRBRGRGRGRGRGRBRGRGRGBGBGRGRGRBRGR
GBGBGRGRBRGRGBGRGBGRGRGBGRBRGRGRGRGRGRGRG
RGRGRGRGRBRGRGRGBGRGRGRGBGRGRBRBRGRGRGRGR
GRGBGBGBGRBRGRGRGBGBGBGRGBGRGRBRGBGBGRGRG
RGRGBGRGRGRGBGRGRGRGRGBGRGBGBGRGRGRGRGRGB
GBGRGRGRGBGBGBGRGRBRBRGBGBGRGRGRGRGBGBGBG
RGRBRGRGRGBGBGRGRGRBRGRGBGRGBGRBRGBGBGRGR
BRGRGB...

result:

ok ok

Test #260:

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

input:

96 19
3 912
BGGRRGGRGBGGBGRGGGG
RRGBBGGGRBBBGRBRGBB
GGGRRRGGBRRRRBGBBBG
GGRBGRGGRBRRBRRGBRR
RBRRRBBRBBRRRGGBGGR
BRGGGBGGBBGBGBRBRRR
GBGBBGBBBBBBRBGRRGG
RRGGBBBBBGRRGBBRRGB
GRGBGRGGGRRGRBBBBRG
GGRBGRGGRGRRGRBBRGB
GRBBBBRRGRGGGGRRRRG
RRGGBGBGGRRRRGGRBBB
GBGGGRGGGRGGGGBRRRB
GGBBBBRRBBRBGGGRGRG
RRRGRRRB...

output:

BGRGRGRGRGRGBGRGRGR
GRGBGRGRGBGBGRBRGBG
RGRGRGRGBGRGRBRGBGR
GRGBGRGRGBGRBRGRGRG
RBRGRGBGBGRGRGRGRGR
BRGRGBGRGBGBGBGBGRG
RBRGBGBGBGBGRGRGRGR
GRGRGBGBGRGRGBGRGRB
RGRGRGRGRGRGRGBGBGR
GRGBGRGRGRGRGRGBGRB
RGBGBGRGRGRGRGRGRGR
GRGRGRBRGRGRGRGRGBG
RBRGRGRGRGRGRGBGRGB
GRGBGBGRGBGBGRGRGRG
RGRGRGRBRGBGRGBGBGB
...

result:

ok ok

Test #261:

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

input:

21 59
3 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:

ok ok

Test #269:

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

input:

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

output:

GRGRBRGRGRGRGBGBGBGRGRGRGR
RGBGRBRGBGBGBGRGRGBGRBRGBG
GRGBGRGRGRGRGRGBGRGRGRGRGR
RGRGBGRGRGRGRGRGRGRBRGRGRG
GRGBGBGRGRGRGBGBGRGRGBGBGR
BGRGBGBGRGRGRGRGBGBGRGRGRG
GBGRGRGBGRGRGBGRGBGRGRBRGR
RGBGRGRGRGBGBGRGBGRBRGRGRG
BRGRGBGRGRGRGRGBGRGRGBGBGR
RGBGRGBGBGRGRGBGBGRBRGBGRG
GBGRGRGRGRGRGBGRGRGRGRGRGR
BGR...

result:

ok ok

Test #270:

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

input:

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

output:

GBGRG
BGBGB
GRGRG
BGRGB
GRGRG
RGRGR
GRGBG
RGBGR
GRGBG
BGRGR
GBGRG

result:

ok ok

Test #271:

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

input:

100 100
3 5000
GGGGGGGGGGGGGGGGGGGGBBBBBBBBBBGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBRRRRRRRRRR
GGGGGGGGGGGGGGGGGGGGBBBBBBBBBBGGGGGGGGGG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