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;
char dum[3007][3007];
int main()
{
int n, m;
cin >> n >> m;
for(int i = 1; i <= n; ++i)
{
string s;
cin >> s;
for(int j = 1; j <= m; ++j)
dum[i][j] = s[j-1];
}
int odp = 0;
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= m; ++j)
{
if(dum[i][j] == 'R' && dum[i][j+1] == 'G' && dum[i][j+2] == 'W')
{
if(dum[i-1][j+1] == 'R' && dum[i+1][j+1] == 'W')
{
++odp;
dum[i-1][j+1] = '.';
dum[i][j+1] = '.';
dum[i][j+2] = '.';
}
else
{
++odp;
dum[i][j] = '.';
dum[i][j+1] = '.';
dum[i][j+2] = '.';
}
}
if(dum[i-1][j] == 'R' && dum[i][j] == 'G' && dum[i+1][j] == 'W')
{
++odp;
dum[i-1][j] = '.';
dum[i][j] = '.';
dum[i+1][j] = '.';
}
}
cout << odp;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |