QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393252#8599. Кольорова таблицяNetwork_Error27 1ms3792kbC++142.3kb2024-04-18 13:33:022024-04-18 13:33:02

Judging History

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

  • [2024-04-18 13:33:02]
  • 评测
  • 测评结果:27
  • 用时:1ms
  • 内存:3792kb
  • [2024-04-18 13:33:02]
  • 提交

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 c[3]={0,0,0};
		for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)++c[a[i][j]];
		int x=c[0]=min({c[0],c[1],c[2]})?0:c[1]==min({c[0],c[1],c[2]})?1:2;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)
				if(a[i][j]==x)a[i][j]=2;
				else if(a[i][j]==2)a[i][j]=x;
		
		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: 0
Wrong Answer

Test #1:

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

input:

1 34
3 17
GGGRBGGBBGGBGBGBBRGGGRRRBBGGGBBRGB

output:

GRGBGRGRGRGRGRGRGBGRGBGBGRGRGRGBGR

result:

wrong answer can change at most Q positions

Subtask #2:

score: 7
Accepted

Test #31:

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

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

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

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

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

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #36:

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

input:

1 96
2 48
GRRGGRRGGRRGGGGGRRGRRGGGRRGRGGRRRGGRRRGGGGRGRGRGGRGGGGRGRGRRGRGGGRRRGGGRGRGGRGRGRRRRRRGRRGRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #37:

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

input:

1 44
2 22
GRRGGRRRRRRRRRRGRRGRRGRGGGGGGGGRGGGGRGRGRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #38:

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

input:

1 88
2 44
GGRRRRGRRGRGGGRGRGRRGRGGGRRGGRRRRGRRGRGRGRRRRGRRRGRRGRRGRRRRGRGGGRRRGRGRGRGGGGGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #39:

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

input:

1 29
2 14
RGGGGRGRRGRRRRGRRRRGRGRGRRRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #40:

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

input:

1 25
2 12
RRGGGGRRRRGGGGRGRRGGGRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #41:

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

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: 3608kb

input:

1 66
2 33
GGRGGGRGRGRGRGRRRRRGGRRRGRGGRGGGGRRRGGGRRGRRGRRGRRRGRRGGGRRRRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #44:

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

input:

1 10
2 5
GRGRRGRGRG

output:

RGRGRGRGRG

result:

ok ok

Test #45:

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

input:

1 51
2 25
GRGGGGGGGRGGRGGRRGGRGRRRGRRRRRGGRRRRGGRGRGGGRRRGGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #46:

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

input:

1 99
2 49
RRRGRGRGGRGGGRGGRRRRGGGRRGGRRRRRGRRGRGGRGRRRRRRGGRGRGGGRRRRGGGGGRGGRRRRRGRGGGRGRRGGGGGRGRGGGRGRRGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #47:

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

input:

1 39
2 19
RGRRRGRRGRGRRGRGRGGRRRRGRRGRRRRRRRGRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #48:

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

input:

1 92
2 46
RGRGGGGRRGRGGRRGRRGGGRGGGGGGRGGRGRGGGGGGGGRRGRRGRGRGGRGGRGRGGGRRRRGRRGRGGRRRGRRGGGRGRRRRRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #49:

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

input:

1 36
2 18
GGGRRGGRRGRRRGRGRRRGGGRGRRRGGGRGGGGG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #50:

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

input:

1 15
2 7
GRRGGRGRGRRRGGG

output:

GRGRGRGRGRGRGRG

result:

ok ok

Test #51:

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

input:

1 59
2 29
RRGRGRGRRRGGRRGGGRGGRGGGGRGGGRRGRRRGGGRRGGRGGGGGGGRRRGGGRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #52:

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

input:

1 99
2 49
RRGGRRRGRRGGGGRGGGGGGRRGRGRGGRGGGRRRRRGRRRRGRGGRGGGRRRRRGGRGGGGGRRGGRGGGRRGGGRGGRGRGGRRGRRGGGRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #53:

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

input:

1 52
2 26
RGGRGRGGGGGRRRRRGRRGGGGGGRRRGRRGRRRGRGRGGRGGRGGRRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #54:

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

input:

1 96
2 48
GGRRGRGGGGGGGGRRGGGGRRRRGGRRGGGRGRRRGGRGRGRRRGGGRGRGGRGRRGRRRGGRGGRGRRGRGRGGGRRRRRRGRGRRRGGGGRRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #55:

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

input:

1 40
2 20
GGRGRRRRGGRRRRGRGGGRGRGRRRGRGGRRGGGGGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #56:

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

input:

1 85
2 42
GRGRGRRRRRRRGGGRGRRRGGRRGGGGRRGRRGGRGGRRRRGGGGGRRRRRGGGRRRGRRGGRGGRGGRGRGRRRRGGRGRRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #57:

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

input:

1 25
2 12
RRGGRRGRRRRGRRRRGGRRRRGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #58:

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

input:

1 70
2 35
RGRRRRGRGRGRGRRGGRGRGGRGGRRGRRRGRGGRRRGGRGGGRGGRGRGRGRGRRRGRRRRGGRRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #59:

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

input:

1 26
2 13
RGRRGRRGGGGGRGGGRRGGGGGGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #60:

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

input:

1 100
2 50
GGGRRGRRRGGGRGGRRGRRGGRRGRGGRGRGGGRRRRRRRGRGRRRGRRRGRGRGGRRRRGGGGGRRGGRGRGGGRGGRRGRGRGRGGRGGRRRGRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Subtask #3:

score: 3
Accepted

Test #61:

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

input:

79 100
3 7900
RRRRBBGGGRGRGRGRGGGGRBBRRRGBRGRGRBBRGGBRRBBRGRGRBBBRGRBBRBBBRGGBGGRBGBBGGGBRGBRRGBBBGGGGRGGGRGRGBBGG
RGBRBGGGGGRBGRGBGGBGRBRBBRBBRRGRGGGBRRBRGRG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GRBRGBGBGBGBGRGRBRGRG...

result:

ok ok

Test #65:

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

input:

79 74
3 5846
RRGRGRBBRRBRGBRRGBRGRRBRBGGGRRBRGGGGRRBBBRBRRGGRRBRBRBRGBBBGRGGGBBBGBBRBBG
RRRBRBGBGBRRGRGRRRRRGBGRGBGBBRGGBBRRRBGBBGBGRRGRGGGRRGBRRRGBGRGRBGGGGGBGBR
GBBRBGBGRRGBGGBBRRBBBGGBBRBBGBGGRGBRGGRBRGRRRRGGRGGGBGRBGRRBBBBBGRGRGRBRBG
GGRGGRBRBRRRGGBRRBGRGGBBBBGGBBRBBGBRGBGBGGGGGRBBBRBRGRBBGRBRBR...

output:

GBGBGBGRGBGBGRGBGRGRGBGBGRGRGBGBGRGRGBGRGBGBGRGBGRBRGRBRGRGRBRGRGRGRGRBRGR
BGBGBGRGRGBGRBRGBGBGRGRGRGRGRGRGRGBGBGRGRGRGBGRGRGRGBGRGBGRGRBRBRGRGRGRGRB
GRGBGRGRGBGRGRGRGBGRGRGRGBGRGRGRBRGBGRBRBRGBGBGRBRGRGRBRGBGRGRGRGBGBGBGBGR
RGBGRBRBRGBGRGRGBGRBRGRGRGRGRGBGRGRGRGRGRGRGRGRGRBRBRBRGRGRBRGBGBGRGBGBGRG
...

result:

ok ok

Test #66:

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

input:

3 26
3 78
BGRBBRGRRGGGRGRRRRBBGBRBRG
RRBRBBBGRBBBBRRBRGRRBRGRBR
RBGRGBBBRRRBRBBRBBBRRBGGGB

output:

GRBRGBGBGRGRBRGBGBGRGRBRBR
BGRGRGRGBGRGRGBGBGBGRBRBRB
GRGBGRGRGBGRBRGBGRGBGRGRGR

result:

ok ok

Test #67:

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

input:

31 71
3 2201
RBGRRBGRRGRRRGBBGRBRRGBRRRGBGGGGGGRGRRBRGRGGRGGBRBGBRRBRRBRGGGGRGBGBGBG
BGGGRGBGBBBGRBB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BGRBRGRGRGRGRGRGBGBGRGRGRBRBRGBGRGBGRGBGBGBGR
GRGRGRGRGRBRGRGRGRGRGBGBGRGBGRGRGBGBGBGBGRGRGBGRG
BGRGBGBGRGRGRBRGRGRGRGRGRGRGBGRGRGRGBGRGRGRGBGRGR
...

result:

ok ok

Test #90:

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

input:

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

output:

GRGBGBGRGRGRGRGBGBGRBRGBGRG
BGRGBGRGBGRGRGBGRGRBRGBGRGR
GBGRGRGRGBGRGRGRGRGRGRGRGBG
RGBGRGRGRGBGRGRGBGRGBGBGRGR
BRGBGBGRGRGRGBGBGBGRGRGRGRG
RGBGRGRGRGBGBGRGRGBGRGRGRGR
GRGRGRGRGRGRGRGRBRGBGRGRGRG
BGRGRGRGRGRGBGRGRGRGRGRGRBR
GRGRGRGRGRBRGRBRGRGRGBGRBRG
BGRGRGBGRGRGBGRGBGBGBGRGRGR
GRGRGRGRGRGRGBGRGRGB...

result:

ok ok

Subtask #4:

score: 0
Wrong Answer

Test #91:

score: 0
Wrong Answer
time: 0ms
memory: 3680kb

input:

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

output:

BGBGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGBGRGBGBGRGRGRGRGRGRGR
GRGRGBGBGBGBGRGBGBGBGBGBGBGBGBGBGBGRGBGRGRGRGRGRGRGRGRGRGBGRGRGRGBGBG
BGBGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGBGRGBGBGRGRGRGRGRGRGR
GRGRGBGBGBGBGRGBGBGBGBGBGBGBGBGBGBGRGBGRGRGRGRGRGRGRGRGRGBGRGRGRGBGBG
BGBGRGRGRGRGRGRGRGRG...

result:

wrong answer can change at most Q positions

Subtask #5:

score: 0
Wrong Answer

Test #121:

score: 0
Wrong Answer
time: 0ms
memory: 3696kb

input:

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

output:

RGBGRGRGRGBGBGBGRGRGRGBGRGBGBGRGBGRGBGRGBGBGRGRGRGRGRGRGRGBGBGRGRGRG
GRGRGBGRGRGRGBGBGRGBGRGRGRGRGRGBGBGBGBGRGRGRGRGRGRGBGRGRGRGBGRGRGRGB
RGBGRGRGRGBGBGBGRGRGRGBGRGBGBGRGBGRGBGRGBGBGRGRGRGRGRGRGRGBGBGRGRGRG
GRGRGBGRGRGRGBGBGRGBGRGRGRGRGRGBGBGBGBGRGRGRGRGRGRGBGRGRGRGBGRGRGRGB
RGBGRGRGRGBGBGBGRGRGRGBG...

result:

wrong answer can change at most Q positions

Subtask #6:

score: 0
Wrong Answer

Test #151:

score: 0
Wrong Answer
time: 0ms
memory: 3688kb

input:

4 10
3 26
BGGRRBBRBG
BGBGGBGRRB
RBBBBBRGGR
RGRBGGRGBB

output:

RGRGBGRGRG
GRGRGRGBGR
BGRGRGBGRB
GRBRGRGRGR

result:

wrong answer can change at most Q positions

Subtask #7:

score: 0
Wrong Answer

Test #181:

score: 0
Wrong Answer
time: 0ms
memory: 3676kb

input:

4 52
3 104
GRRGGGGBGRRBRGBRGRGRRBGBGBBRGGRRBBGBGBGBGGBRRRRBRRRG
RGBGGGRGBGRBGRRBBBBRGRRBBBBGGBRGRBBRGGRBRGBRBGRBBGGR
RBRGBGBGGRBBGGGRRRRBBRGRRGGBRGGRGRRGBRRRGRRBRGRGRBGG
GRBBRRRRGGBRBBBGBBGGBRRGRGGBGGBRRGBRBBRRBGGBGBBBRRRR

output:

GBGRGRGRGBGRBRGBGBGBGRGRGRGBGRGBGRGRGRGRGRGBGBGRGBGR
BGRGRGBGRGBGRGBGRGRGRGBGRGRGRGBGBGRBRGBGBGRGRGBGRGRB
GRBRGRGRGBGRGRGBGBGRGBGBGRGRBRGBGBGRGBGBGBGRBRGRGRGR
RBRGBGBGRGRBRGRGRGRGRGBGBGRGRGRGBGRBRGBGRGRGRGRGBGBG

result:

wrong answer can change at most Q positions

Subtask #8:

score: 17
Accepted

Test #211:

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

input:

42 54
2 1134
GGRRGGGGGGGGRRGGRRRGGGRRGRRGGGGGGRRGGGGGGGGGGRGGRRRGRG
RRRGGGRGGGRRRGGRRRRRRGGRGRGRGGRGGGRGRGRRGRRGGRGRRGGRRR
RGGGRGRGGGRGGGGGRGGRGRGGGGGGGGGRRRGRRGGGRRGRGRGGGGGG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GGRGRRGGRRGRGRR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Test #215:

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

input:

46 36
2 828
RGRRRGGRRRRRGRRRRGRRRRRGRGRRGRRGRRGG
GGRGGGRRGRGRGGGRRRGRRRRRRRGRGRRGRGRG
RGRGGRRGGGRRGRRGGGGGGGRGRRGGRRGRRRRG
RGGGRRGRRRGRRRRGGRGGRGRGGRRGGRGGGRRG
GGRRGRGGRRGRRGRRGGRGGGRGRRRRRRRRRRGR
RGGRGRRRRRGRGRRGGRGRGGGRGRGRGGGGRGGG
GRGRGRGRGRRGGRGGRGRGGRRGRGRGRGGGGRRG
RGRGRRRGGGRRRGRRRGRGGGRRRGRRG...

output:

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

result:

ok ok

Test #216:

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

input:

70 80
2 2800
GGRR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ok

Test #224:

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

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: 3608kb

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: 0ms
memory: 3712kb

input:

52 50
2 1300
RRRGRRRGGGGRGRRGGRGGGRGGGRRGGGGRGGGRRRGRRRGRRRGGGG
RRRGGRGGGRGRGRGRGGG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ok

Subtask #9:

score: 0
Wrong Answer

Test #241:

score: 0
Wrong Answer
time: 0ms
memory: 3720kb

input:

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

output:

GBGRGRGRBRBRGRG
RGBGBGRGRBRGRGB
BRGRGRGRGRGRGRG
RGBGBGBGRGBGRGB
GBGRGRGRGBGBGBG
RGBGRGRGRGRGRGB
BRGBGRGBGBGBGBG
RBRGRGBGBGRGBGR
GRGBGRGRGBGBGRG
BGBGRGRGRGRGBGR
GBGRGRBRGRGRGRG
RGBGRGRGBGBGRGR
GRGBGRGRGRGBGRG
RBRGRGRGBGRGRGR
GRGRBRGRGBGRGRG
RGRGRGBGBGRGBGR
GBGRGRGBGRGRGBG
RGBGBGBGRGRGBGR
GBGRGRGBGRGR...

result:

wrong answer can change at most Q positions