#include <bits/stdc++.h>
using namespace std;
// author: Movlan
#define ll long long
//#define int long long
#define br "\n"
#define sp " "
#define pb push_back
#define pf push_front
typedef pair<ll,int> pii;
#define vi vector<int>;
#define vpii vector<pair<int,int>>
#define all(x) x.begin(),x.end()
#define sync ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
struct edge{
//int u;
int v;
ll w;bool operator<(edge const& other){return w<other.w;}
};
const int INF=1e9+7,MAXN=100007;
void solve(){
int n,m;
cin>>n>>m;
string arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int res=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(j<m-2 &&(arr[i][j]=='R' && arr[i][j+1]=='G' && arr[i][j+2]=='W')){
res++;
arr[i][j]='A';
arr[i][j+1]='A';
arr[i][j+2]='A';
}
if(i<n-2 &&(arr[i][j]=='R' && arr[i+1][j]=='G' && arr[i+2][j]=='W')){
res++;
arr[i][j]='A';
arr[i+1][j]='A';
arr[i+2][j]='A';
}
}
}
cout<<res;
}
signed main(){
sync;
int t=1;
//cin>>t;
while(t--){
solve();
}
}
/**
Get up and work hard.
There are only a few days left until the final round.
You need to win a medal for everything:
for the days you cried,
for the days you couldn't afford to attend an event,
for the days when the one you loved the most left you,
and for the days when you were at your lowest point with no friends.
Show them what a "cheater" can achieve.
Show them what a true ghost can do.
You've done this many times before.
One more time, and you're good to go.
O N L Y T H E D E A D S E E
**/
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
512 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
1 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
1 ms |
348 KB |
Output is correct |
12 |
Correct |
1 ms |
344 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
0 ms |
348 KB |
Output is correct |
15 |
Correct |
1 ms |
348 KB |
Output is correct |
16 |
Correct |
0 ms |
348 KB |
Output is correct |
17 |
Correct |
1 ms |
344 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
0 ms |
348 KB |
Output is correct |
22 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
23 |
Halted |
0 ms |
0 KB |
- |