QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#393242#8599. Кольорова таблицяNetwork_Error24 1ms3772kbC++141.6kb2024-04-18 13:17:182024-04-18 13:17:18

Judging History

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

  • [2024-04-18 13:17:18]
  • 评测
  • 测评结果:24
  • 用时:1ms
  • 内存:3772kb
  • [2024-04-18 13:17:18]
  • 提交

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,c=0;
		for(int i=1;i<=n;i++)
			for(int j=1;j<=m;j++)if(a[i][j]!=2)c++,sum+=a[i][j]!=(i+j)%2;
		if(sum<=c/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;
				}
		}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)&1)continue;
				if(a[i][j]!=2)continue;
				int x=0;
				if(a[i-1][j]!=2)x=a[i-1][j]; 
				if(a[i+1][j]!=2)x=a[i+1][j]; 
				if(a[i][j-1]!=2)x=a[i][j-1]; 
				if(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: 1ms
memory: 3676kb

input:

1 34
3 17
GGGRBGGBBGGBGBGBBRGGGRRRBBGGGBBRGB

output:

GRGRBRGRBRGRGRGRBRGRGRGRBRGRGRBRGG

result:

wrong answer there can't be two adjacent points on the grid with equal colors 0 32 0 33

Subtask #2:

score: 7
Accepted

Test #31:

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

input:

1 78
2 39
GRGGGRGRGRRRRGGRRRRGRGRGRGGGRGRRRRRRRGGRRGGGGGRGRGGGGGRRGRGRGGGRRRGRGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #32:

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

input:

1 18
2 9
GGRGRRRRGRRRGRGRRG

output:

GRGRGRGRGRGRGRGRGR

result:

ok ok

Test #33:

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

input:

1 63
2 31
RGRRRRRRRGGGRGRRRGGGRRRRGGRRGRRGRGRGGRGGRGRRRGRGRRRRGRRRGGRRGRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #34:

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

input:

1 3
2 1
RGG

output:

RGR

result:

ok ok

Test #35:

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

input:

1 47
2 23
RRGRRRGGGRGGRRGGRGRRGRRRGGRRGRGGGGGGGRGRRRGGGGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #36:

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

input:

1 96
2 48
GRRGGRRGGRRGGGGGRRGRRGGGRRGRGGRRRGGRRRGGGGRGRGRGGRGGGGRGRGRRGRGGGRRRGGGRGRGGRGRGRRRRRRGRRGRGGGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #37:

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

input:

1 44
2 22
GRRGGRRRRRRRRRRGRRGRRGRGGGGGGGGRGGGGRGRGRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #38:

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

input:

1 88
2 44
GGRRRRGRRGRGGGRGRGRRGRGGGRRGGRRRRGRRGRGRGRRRRGRRRGRRGRRGRRRRGRGGGRRRGRGRGRGGGGGGGRRRRRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #39:

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

input:

1 29
2 14
RGGGGRGRRGRRRRGRRRRGRGRGRRRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #40:

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

input:

1 25
2 12
RRGGGGRRRRGGGGRGRRGGGRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #41:

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

input:

1 73
2 36
RRGGRGGRGRRRRRGGRRGGRGRGGRGGGRGRGGGRRRGGRRGRRRRRRGGGRGGGGGGRGRGGGRRRRGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #42:

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

input:

1 22
2 11
RGRRGGGRGGRRGGGRRGRGRR

output:

RGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #43:

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

input:

1 66
2 33
GGRGGGRGRGRGRGRRRRRGGRRRGRGGRGGGGRRRGGGRRGRRGRRGRRRGRRGGGRRRRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #44:

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

input:

1 10
2 5
GRGRRGRGRG

output:

RGRGRGRGRG

result:

ok ok

Test #45:

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

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

input:

1 39
2 19
RGRRRGRRGRGRRGRGRGGRRRRGRRGRRRRRRRGRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #48:

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

input:

1 92
2 46
RGRGGGGRRGRGGRRGRRGGGRGGGGGGRGGRGRGGGGGGGGRRGRRGRGRGGRGGRGRGGGRRRRGRRGRGGRRRGRRGGGRGRRRRRRRR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #49:

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

input:

1 36
2 18
GGGRRGGRRGRRRGRGRRRGGGRGRRRGGGRGGGGG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #50:

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

input:

1 15
2 7
GRRGGRGRGRRRGGG

output:

GRGRGRGRGRGRGRG

result:

ok ok

Test #51:

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

input:

1 59
2 29
RRGRGRGRRRGGRRGGGRGGRGGGGRGGGRRGRRRGGGRRGGRGGGGGGGRRRGGGRGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #52:

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

input:

1 99
2 49
RRGGRRRGRRGGGGRGGGGGGRRGRGRGGRGGGRRRRRGRRRRGRGGRGGGRRRRRGGRGGGGGRRGGRGGGRRGGGRGGRGRGGRRGRRGGGRRRGGR

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #53:

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

input:

1 52
2 26
RGGRGRGGGGGRRRRRGRRGGGGGGRRRGRRGRRRGRGRGGRGGRGGRRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #54:

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

input:

1 96
2 48
GGRRGRGGGGGGGGRRGGGGRRRRGGRRGGGRGRRRGGRGRGRRRGGGRGRGGRGRRGRRRGGRGGRGRRGRGRGGGRRRRRRGRGRRRGGGGRRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #55:

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

input:

1 40
2 20
GGRGRRRRGGRRRRGRGGGRGRGRRRGRGGRRGGGGGRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #56:

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

input:

1 85
2 42
GRGRGRRRRRRRGGGRGRRRGGRRGGGGRRGRRGGRGGRRRRGGGGGRRRRRGGGRRRGRRGGRGGRGGRGRGRRRRGGRGRRGR

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #57:

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

input:

1 25
2 12
RRGGRRGRRRRGRRRRGGRRRRGRR

output:

GRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #58:

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

input:

1 70
2 35
RGRRRRGRGRGRGRRGGRGRGGRGGRRGRRRGRGGRRRGGRGGGRGGRGRGRGRGRRRGRRRRGGRRGGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #59:

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

input:

1 26
2 13
RGRRGRRGGGGGRGGGRRGGGGGGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Test #60:

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

input:

1 100
2 50
GGGRRGRRRGGGRGGRRGRRGGRRGRGGRGRGGGRRRRRRRGRGRRRGRRRGRGRGGRRRRGGGGGRRGGRGRGGGRGGRRGRGRGRGGRGGRRRGRGRG

output:

RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG

result:

ok ok

Subtask #3:

score: 0
Wrong Answer

Test #61:

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

input:

79 100
3 7900
RRRRBBGGGRGRGRGRGGGGRBBRRRGBRGRGRBBRGGBRRBBRGRGRBBBRGRBBRBBBRGGBGGRBGBBGGGBRGBRRGBBBGGGGRGGGRGRGBBGG
RGBRBGGGGGRBGRGBGGBGRBRBBRBBRRGRGGGBRRBRGRGBBBBRGGGGBGGRGGGGRRBRGRRGGRRBGBGBBGRRGBRBRBBGGRGBRGBRRBRR
RBRRGGBGRRGRGGRRRBGGBRRRRGBRRGBGBBBBRBRBBRBRGRBBGRGRBGGBBRGBGRGBRGRRGRRRRRRBRRRGBBBB...

output:

RGRGBGRGRGRGRGRGRGRGRGBGRGRGRGRGRGBGRGBGRGBGRGRGBGBGRGBGRGBGRGRGRGRGRGBGRGBGRGRGRGBGRGRGRGRGRGRGBGRG
GRGRGRGRGRGBGRGBGRGRGBGBGRGBGRGRGRGBGRGRGRGBGBGRGRGRGRGRGRGRGRGRGRGRGRGBGBGBGRGRGBGBGBGRGRGBGRGRGBGR
RGRGRGBGRGRGRGRGRGRGBGRGRGBGRGBGBGBGRGRGBGBGRGBGRGRGBGRGBGRGRGRGRGRGRGRGRGRGRGRGBGBGBGBGBGRGRGRGRG...

result:

ok ok

Test #62:

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

input:

3 45
3 135
RGBBBRRGBBBGRRRRBRBRRGGBBGGRRRBBBGRRGRGGBRRBB
GRRBBBGGRBGRGRBGBRBBBBGBRGGGGBGBBRGGBGRGGRBGR
RRGRGBBGRGBBBRRRBGGGGRRGRGGRRBGBGGBBGBBBGRBBB

output:

RGBGBGRGBGBGRGRGBGBGRGRGBGRGRGBGBGRGRGRGBGRGB
GRGBGBGRGBGRGRGRGRGBGBGBGRGRGBGBGRGRGRGRGRGRG
RGRGRGBGRGBGBGRGBGRGRGRGRGRGRGRGRGBGRGBGRGBGB

result:

ok ok

Test #63:

score: -3
Wrong Answer
time: 0ms
memory: 3540kb

input:

31 89
3 2759
BBBRBRRRBRBRGGBGBRRGBRGGRRGBRRBRRBRBGBRGRBRRRRGBBRRGRRRGBRRGRBRBRRRRGGBRBBGRRBBBBRGBRBBBR
BBRRBRGRRRRGRGRRGBBGRGBGRRGRRGRBGBGGGGBRBBRBBRBRBGBGRBBGRRRGRBGBRBBBGGRRGRBGRBRBRGGGBBRBG
RBBBRBRBRBBBRBRBRBGGGGRBGGRRGGRRGGGGGBGGBGGBRRRBRRGBBGGBRBRGBRGRGGBRGBRBGRGRBRRRGBGBRGGBB
GGBGRRBRRBGGBGRBB...

output:

BGBRBRGRBRBRGRBRBRGRBRGRGRGRGRBRGRGRGRGRGRGRGRGRBRGRGRGRBRGRGRGRGRGRGRBRBRGRGRBGBRGRGRBRG
GBRGRGRGRGRGRGRGRBRGRGRGRGRGRGRBRBRGRGRGRBRBRGRGRGRGRBRGRGRGRBRBRBRBRGRGRGRGRBRBRGRGRBRBR
GRBRGRGRGRBRGRGRGRGRGRGRGRGRGRGRGRGRGRGRBRGRGRGRGRGRBRGRGRGRBRGRGRBRGRGRGRGRBRGRGRGRGRGRB
RGRGRGRGRBRGRGRBRGRGRGRGRGRGRB...

result:

wrong answer there can't be two adjacent points on the grid with equal colors 1 0 2 0

Subtask #4:

score: 0
Wrong Answer

Test #91:

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

input:

8 69
3 276
RGRBGRBRBR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RGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGRGRGBGRG
RGRGRGRGRGRGR
GRGRGR...

result:

ok ok

Test #93:

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

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

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

input:

52 94
3 2444
RGRGRBRGBRBRGRBG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RGBGRGBGBGBGBGBGBGBGBGRGRG
BGBGBGBGRGBGRGRGRGRGRGRGRGRGRGRGRGRGBGR
GRGRGRGRGRGRGRGBGRGB...

result:

ok ok

Test #105:

score: -7
Wrong Answer
time: 1ms
memory: 3624kb

input:

75 80
3 3000
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBGBRBRGBRGBGBGRBRBRGRBGBGBRBGBRGRGBGRB
GBRBGRGRBGBRBGBRGBRBGRBGRBRBGBGRBRGRGRGRGRBG...

output:

GRGRGRGRBRBRBRBRGRGRGRBRGRGRGRGRBRGRGRGRGRBRBRBRGRGRBRBRGRGRGRGRGRGRGRGRGRGRBRGG
RBRBRGRGRGRGRGRGRBRBRGRGRBRBRBRGRGRGRGRGRGRGRGRGRBRGRGRGRBRBRGRBRBRBRBRBRGRGRGRB
GRGRGRGRBRBRBRBRGRGRGRBRGRGRGRGRBRGRGRGRGRBRBRBRGRGRBRBRGRGRGRGRGRGRGRGRGRGRBRGG
RBRBRGRGRGRGRGRGRBRBRGRGRBRBRBRGRGRGRGRGRGRGRGRGRBRGRGRGR...

result:

wrong answer there can't be two adjacent points on the grid with equal colors 0 78 0 79

Subtask #5:

score: 0
Wrong Answer

Test #121:

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

input:

9 68
3 306
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGGGGBRGBBGBBRRRGBGBGBR
GBRBGRBGGGRBRRRRBBGRBGRBBBRBRBBRRRBRRRBBRBRGBBGG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GRGRGBGBG
RGRGRGRGBGRGR
GRGRGR...

result:

ok ok

Test #123:

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

input:

57 53
3 1510
BBRBRBGBBBBBRRBRBRBRBBBGBGBRRGGGBGGGBRRRBBRGRBRBBRBGB
BBRBRBGBBBBBRRBRBRBRBBBGBGBRRGGGBGGGBRRRBBRGRBRBBRBGB
BBRBRBGBBBBBRRBRBRBRBBBGBGBRRGGGBGGGBRRRBBRGRBRBBRBGB
BBRBRBGBBBBBRRBRBRBRBBBGBGBRRGGGBGGGBRRRBBRGRBRBBRBGB
BBRBRBGBBBBBRRBRBRBRBBBGBGBRRGGGBGGGBRRRBBRGRBRBBRBGB
BBRBRBGBBBBBRRBRB...

output:

BGRGRGRGBGBGRGBGBGBGBGBGBGBGRGRGBGRGBGRGBGRGRGRGBGBGB
GBGBGBGBGBGBGRGRGRGRGBGRGRGRGRGRGRGRGRGRGBGRGBGBGRGRG
BGRGRGRGBGBGRGBGBGBGBGBGBGBGRGRGBGRGBGRGBGRGRGRGBGBGB
GBGBGBGBGBGBGRGRGRGRGBGRGRGRGRGRGRGRGRGRGBGRGBGBGRGRG
BGRGRGRGBGBGRGBGBGBGBGBGBGBGRGRGBGRGBGRGBGRGRGRGBGBGB
GBGBGBGBGBGBGRGRGRGRGBGRGRGRGR...

result:

ok ok

Test #124:

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

input:

85 5
3 212
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
GGGRR
G...

output:

GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
GRGRG
RGRGR
...

result:

ok ok

Test #125:

score: -7
Wrong Answer
time: 1ms
memory: 3540kb

input:

9 54
3 243
RBBGGRGGRBRRGGRRBRRRRBBBGRBBBBBBRGBBRBBBBRGGRBGGGRGGGB
RBBGGRGGRBRRGGRRBRRRRBBBGRBBBBBBRGBBRBBBBRGGRBGGGRGGGB
RBBGGRGGRBRRGGRRBRRRRBBBGRBBBBBBRGBBRBBBBRGGRBGGGRGGGB
RBBGGRGGRBRRGGRRBRRRRBBBGRBBBBBBRGBBRBBBBRGGRBGGGRGGGB
RBBGGRGGRBRRGGRRBRRRRBBBGRBBBBBBRGBBRBBBBRGGRBGGGRGGGB
RBBGGRGGRBRRGG...

output:

GRBRGRGRGRGRGRGRBRGRGRBRGRBGBGBRGRBRGRBGBRGRGRGRGRGRGG
RBRGRGRGRBRGRGRGRGRGRBGBRGRBGBGBRGRBRBGBRGRGRBRGRGRGRB
GRBRGRGRGRGRGRGRBRGRGRBRGRBGBGBRGRBRGRBGBRGRGRGRGRGRGG
RBRGRGRGRBRGRGRGRGRGRBGBRGRBGBGBRGRBRBGBRGRGRBRGRGRGRB
GRBRGRGRGRGRGRGRBRGRGRBRGRBGBGBRGRBRGRBGBRGRGRGRGRGRGG
RBRGRGRGRBRGRGRGRGRGRBGBR...

result:

wrong answer can change at most Q positions

Subtask #6:

score: 0
Wrong Answer

Test #151:

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

input:

4 10
3 26
BGGRRBBRBG
BGBGGBGRRB
RBBBBBRGGR
RGRBGGRGBB

output:

BRGRGRBRBR
RGRGRBRGRB
GRBRBRGRGR
RGRBRGRGRB

result:

ok ok

Test #152:

score: -13
Wrong Answer
time: 1ms
memory: 3664kb

input:

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

output:

GRBRGRGRBRBRGRGRBRGRGRGRBRGRBRBRGRGRGRGRGRGRGRGRBRBRGRG
RGRGRBRBRGRBRGRGRBRBRGRGRGRGRBRGRBRGRGRGRBRGRGRBRGRGRGR
GRGRGRGRGRBRBRGRGRGRBRBRGRGRGRGRGRBRBRGRGRBRGRGRGRGRGRG
RBRGRBRGRBRGRGRGRGRGRGRGRGRGRGRGRGRBRBRGRGRGRGRGRGRGRBG
GRBRBRBRGRGRGRGRGRGRBRGRBRGRBRGRGRBRGRGRGRBRGRGRGRGRGRG
RGRGRGRGRGRBRGRGRGRG...

result:

wrong answer there can't be two adjacent points on the grid with equal colors 2 54 3 54

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:

GRGRGRGRGRGRGRBRGRGRGRGRGRBRGRGRBRGRGRGRGRBRGRGRGRGR
RGRGRGRGRGRBRGRBRBRGRGRBRBRGRBRGRBRGRGRBRGRGRGRBRGRG
GRGRBRBRGRBRGRGRGRGRBRGRGRGRGRGRGRGRBRGRGRGRGRGRGRGR
RGRBRGRGRGRGRBRGRBRGRGRGRGRBRGRGRGRGRBRGRGRBRBGBRGRG

result:

wrong answer there can't be two adjacent points on the grid with equal colors 2 46 3 46

Subtask #8:

score: 17
Accepted

Test #211:

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

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

input:

70 95
2 3325
GRRGRGGGGGGRRGGRRGRGRGGRRG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GRGRGRGRGRGR...

result:

ok ok

Test #227:

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

input:

80 90
2 3600
GRGRRRRRRGGGRGRGGGRGRGRGRGRGGRRGRGGGRGRRGGRGRRGGGGGRRGRGRGGGGRGGRRRGGGGRGRRGGGGGGGRRGRRGGG
RGGGRGGRGRRGGRRRGGRGRGRGRRGRRGRRGRRGGGRGRRRRRRRRGGGRRGRGGGGGGRRRGRGGGGRGGRGRGRRRGRRRRRGRRG
GRRGGGRRRRRGGGGRRGGGGRRRGRGGRRGGGRGRRRGGGRRRGRGGGRRGGGRGRGGRRRRRGGRGGGRGRRRRGRGRRGGGRRRRGG
RGGRGRGRRGRGRR...

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
RGRGRGRGRGRGRGRGRGRGRGRGRGR...

result:

ok ok

Test #228:

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

input:

4 35
2 70
GGGGGRGRRGRGGRGRGRRRGRGRGRGGGRGGGGG
RGRRGRGGGGRGRGGGRRGRRGGRRRGRGGGGGRR
RRRRRRRGGGGRGRGRRRGGGRGGRGGRRRGRGRG
GRRGRRRRRRGRRRGRGGRRGGGRGGGRRGGGRGG

output:

GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR
GRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRG
RGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGRGR

result:

ok ok

Test #229:

score: 0
Accep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RBRGRGRGRGG
BRGRBRGRGRBRBRG
RGRGRBRGRBRBRGG
GRBRBGBRBRGRGRG
RGRGRBRBRGRGRGG
BRGRGRGRGRGRGRG
RGRGRGRBRGRGRBR
GRGRBRGRGRBRBRB
RGRGRGRGRGRBRGG
GRGRGRGRGRGR...

result:

wrong answer can change at most Q positions