This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
const int mod=1e9+7;
int n,m,tk[3030][3030],ans;
char a[3030][3030];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
//freopen("dec.in","r",stdin);
//freopen("dec.out","w",stdout);
cin>>n>>m;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<n;i++)
{
for(int j=0;j<m;j++)
{
if(a[i][j]=='R'&&a[i][j+1]=='G'&&a[i][j+2]=='W'&&tk[i][j]+tk[i][j+1]+tk[i][j+2]==0)
{
ans++;
tk[i][j]++;
tk[i][j+1]++;
tk[i][j+2]++;
}
if(a[i][j]=='R'&&a[i+1][j]=='G'&&a[i+2][j]=='W'&&tk[i][j]+tk[i+1][j]+tk[i+2][j]==0)
{
ans++;
tk[i][j]++;
tk[i+1][j]++;
tk[i+2][j]++;
}
}
}
cout<<ans;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |