#include <bits/stdc++.h>
using namespace std;
int main(){
int n,m,sayac=0;
cin>>n>>m;
char renkler[m][n];
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
cin>>renkler[i][j];
}
}
for(int i=0; i<n; i++){
for(int j=0; j<m; j++){
if(renkler[i][j]=='R' && renkler[i+1][j]=='G' && renkler[i+2][j]=='W'){
sayac+=1;
renkler[i][j]=renkler[i+1][j]=renkler[i+2][j]=0;
}
else if(renkler[i][j]=='R' && renkler[i][j+1]=='G' && renkler[i][j+2]=='W'){
sayac+=1;
renkler[i][j]=renkler[i][j+1]=renkler[i][j+2]=0;
}
}
}
cout<<sayac;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |