QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393253#8599. Кольорова таблицяNetwork_Error27 1ms3784kbC++142.3kb2024-04-18 13:33:422024-04-18 13:33:42

Judging History

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

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

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

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

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

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

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

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

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #36:

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

input:

1 96
2 48
GRRGGRRGGRRGGGGGRRGRRGGGRRGRGGRRRGGRRRGGGGRGRGRGGRGGGGRGRGRRGRGGGRRRGGGRGRGGRGRGRRRRRRGRRGRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #37:

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

input:

1 44
2 22
GRRGGRRRRRRRRRRGRRGRRGRGGGGGGGGRGGGGRGRGRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #38:

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

input:

1 88
2 44
GGRRRRGRRGRGGGRGRGRRGRGGGRRGGRRRRGRRGRGRGRRRRGRRRGRRGRRGRRRRGRGGGRRRGRGRGRGGGGGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #39:

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

input:

1 29
2 14
RGGGGRGRRGRRRRGRRRRGRGRGRRRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #40:

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

input:

1 25
2 12
RRGGGGRRRRGGGGRGRRGGGRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #41:

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

input:

1 73
2 36
RRGGRGGRGRRRRRGGRRGGRGRGGRGGGRGRGGGRRRGGRRGRRRRRRGGGRGGGGGGRGRGGGRRRRGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #42:

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

input:

1 22
2 11
RGRRGGGRGGRRGGGRRGRGRR

output:

RGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #43:

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

input:

1 66
2 33
GGRGGGRGRGRGRGRRRRRGGRRRGRGGRGGGGRRRGGGRRGRRGRRGRRRGRRGGGRRRRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #44:

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

input:

1 10
2 5
GRGRRGRGRG

output:

RGRGRGRGRG

result:

ok ok

Test #45:

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

input:

1 51
2 25
GRGGGGGGGRGGRGGRRGGRGRRRGRRRRRGGRRRRGGRGRGGGRRRGGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #46:

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

input:

1 99
2 49
RRRGRGRGGRGGGRGGRRRRGGGRRGGRRRRRGRRGRGGRGRRRRRRGGRGRGGGRRRRGGGGGRGGRRRRRGRGGGRGRRGGGGGRGRGGGRGRRGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #47:

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

input:

1 39
2 19
RGRRRGRRGRGRRGRGRGGRRRRGRRGRRRRRRRGRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #48:

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

input:

1 92
2 46
RGRGGGGRRGRGGRRGRRGGGRGGGGGGRGGRGRGGGGGGGGRRGRRGRGRGGRGGRGRGGGRRRRGRRGRGGRRRGRRGGGRGRRRRRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #49:

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

input:

1 36
2 18
GGGRRGGRRGRRRGRGRRRGGGRGRRRGGGRGGGGG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #50:

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

input:

1 15
2 7
GRRGGRGRGRRRGGG

output:

GRGRGRGRGRGRGRG

result:

ok ok

Test #51:

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

input:

1 59
2 29
RRGRGRGRRRGGRRGGGRGGRGGGGRGGGRRGRRRGGGRRGGRGGGGGGGRRRGGGRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #52:

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

input:

1 99
2 49
RRGGRRRGRRGGGGRGGGGGGRRGRGRGGRGGGRRRRRGRRRRGRGGRGGGRRRRRGGRGGGGGRRGGRGGGRRGGGRGGRGRGGRRGRRGGGRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #53:

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

input:

1 52
2 26
RGGRGRGGGGGRRRRRGRRGGGGGGRRRGRRGRRRGRGRGGRGGRGGRRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #54:

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

input:

1 96
2 48
GGRRGRGGGGGGGGRRGGGGRRRRGGRRGGGRGRRRGGRGRGRRRGGGRGRGGRGRRGRRRGGRGGRGRRGRGRGGGRRRRRRGRGRRRGGGGRRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #55:

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

input:

1 40
2 20
GGRGRRRRGGRRRRGRGGGRGRGRRRGRGGRRGGGGGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #56:

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

input:

1 85
2 42
GRGRGRRRRRRRGGGRGRRRGGRRGGGGRRGRRGGRGGRRRRGGGGGRRRRRGGGRRRGRRGGRGGRGGRGRGRRRRGGRGRRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #57:

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

input:

1 25
2 12
RRGGRRGRRRRGRRRRGGRRRRGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #58:

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

input:

1 70
2 35
RGRRRRGRGRGRGRRGGRGRGGRGGRRGRRRGRGGRRRGGRGGGRGGRGRGRGRGRRRGRRRRGGRRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #59:

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

input:

1 26
2 13
RGRRGRRGGGGGRGGGRRGGGGGGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #60:

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

input:

1 100
2 50
GGGRRGRRRGGGRGGRRGRRGGRRGRGGRGRGGGRRRRRRRGRGRRRGRRRGRGRGGRRRRGGGGGRRGGRGRGGGRGGRRGRGRGRGGRGGRRRGRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Subtask #3:

score: 3
Accepted

Test #61:

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

input:

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

result:

ok ok

Test #65:

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

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

input:

3 26
3 78
BGRBBRGRRGGGRGRRRRBBGBRBRG
RRBRBBBGRBBBBRRBRGRRBRGRBR
RBGRGBBBRRRBRBBRBBBRRBGGGB

output:

RBRGRGBGRGBGRBRGRGRGBGRGRB
GRGRGRGBGRGRGRGRGBGRGRGRGR
RGBGBGRGRGRGRGRGRGRGRGBGBG

result:

ok ok

Test #67:

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

input:

31 71
3 2201
RBGRRBGRRGRRRGBBGRBRRGBRRRGBGGGGGGRGRRBRGRGGRGGBRBGBRRBRRBRGGGGRGBGBGBG
BGGGRGBGBBBGRBB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GRGRGBGBGBGBGRGRGRGBGRGRGRGRGRGBGRGRBRGRGBGBG
RGRBRGRGRGRGBGRGRGBGRGRGRGRGRGRGRGBGRGRGRBRGRGRGR
GRGRGBGBGRGRGRGRGRGBGBGRGBGRGRGBGRGRGRBRGRGRGBGRG
...

result:

ok ok

Test #90:

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

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

input:

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

output:

RGRGBGRGRGRGRGRGRGRGBGRGBGBGBGBGRGRGRGRGRGRGRGRGRGBGRGRGRGRGRGRGRGRGB
GBGRGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGBGRGBGBGRGRGBGBGRGBGBGBGRGRG
RGRGBGRGRGRGRGRGRGRGBGRGBGBGBGBGRGRGRGRGRGRGRGRGRGBGRGRGRGRGRGRGRGRGB
GBGRGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGBGRGBGBGRGRGBGBGRGBGBGBGRGRG
RGRGBGRGRGRGRGRGRGRG...

result:

wrong answer can change at most Q positions

Subtask #5:

score: 0
Wrong Answer

Test #121:

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

input:

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

output:

BGRGBGRGBGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGBGRGRGRGRGRGRGRG
GRGRGRGBGBGRGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGBGRGRGBGRGRGBGBGBGR
BGRGBGRGBGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGRGRGRGBGBGRGBGRGRGRGRGRGRGRG
GRGRGRGBGBGRGRGRGRGRGBGRGRGRGRGRGRGRGRGRGRGBGRGBGBGRGRGBGRGRGBGBGBGR
BGRGBGRGBGRGRGRGRGBGRGRG...

result:

wrong answer can change at most Q positions

Subtask #6:

score: 0
Wrong Answer

Test #151:

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

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: 19
Accepted
time: 0ms
memory: 3680kb

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

input:

3 4
3 6
RRRR
GBGR
RRGB

output:

RGRG
GBGR
RGRB

result:

ok ok

Test #183:

score: -19
Wrong Answer
time: 0ms
memory: 3692kb

input:

1 48
3 24
BBGBBRRGGBBRRGRBBBBBRRGBGBRRGGBGRGBBBRRRRRRRGRGB

output:

RGBGRGRGBGRGRBRGRGRGRGBGBGRGBGRBRBRGRGRGRGRGBGBG

result:

wrong answer can change at most Q positions

Subtask #8:

score: 17
Accepted

Test #211:

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

input:

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

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #212:

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

input:

70 95
2 3325
GRRGRGGGGGGRRGGRRGRGRGGRRGGRGGRRGRRRGGRGRGGGGRGRRRRGRGRGGGRRGGRRRGGGGRGRRRRRRRRGRRRGRRGGGRGRGGR
GRGRRRGRGRGRGRRGGRRRRRGGRRGGGRGRRGGGRRRRRRRGGGRRRGRRRRRRGRRGGGGRGGRGGGGGGRGRGGGGRRRGGGRGGGRGGRR
RGGRRGGGGRGGRGRGGGGGRRRRRRGRRGRRGRGGRRGGRRGGGGRRGGRRGRGRGRGRRGRGRRRRGRGGRRRGGRGRGGRGRGRRGRGRGRR...

output:

RGRGRGRGRGRG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RGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG...

result:

ok ok

Subtask #9:

score: 0
Wrong Answer

Test #241:

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

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