Submission #1289584

#TimeUsernameProblemLanguageResultExecution timeMemory
1289584ey00Dango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms576 KiB
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
    ios::sync_with_stdio(0);
    cin.tie(0);
    int n,m;cin>>n>>m;
    char c[n][m];
    int cnt=0;
    for(int i=0;i<n;i++){
		for(int j=0;j<m;j++){
			cin>>c[i][j];
		}
	}
	for(int i=0;i<n;i++){
		for(int j=0;j<m-2;j++){
			if(c[i][j]=='R'){
				if(c[i][j+1]=='G'){
					if(c[i][j+2]=='W'){
						c[i][j]='A';
						c[i][j+1]='A';
						c[i][j+2]='A';
						cnt++;
						j+=2;
					}
					else j++;
				}
			}
		}
	}
	for(int i=0;i<m;i++){
		for(int j=0;j<n-2;j++){
			if(c[j][i]=='R'){
				if(c[j+1][i]=='G'){
					if(c[j+2][i]=='W'){
						c[j][i]='A';
						c[j+1][i]='A';
						c[j+2][i]='A';
						cnt++;
						j+=2;
					}
					else j++;
				}
			}
		}
	}
	cout<<cnt;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...