This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
/*
RGW
G
W
*/
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
char C[n+1][m+1];
int D[n+1][m+1], M=0;
for (int i = 0; i <= n; i++)
{
for (int y = 0; y <= m; y++)
{
D[i][y] = 0;
}
}
for (int i = 1; i <= n; i++)
{
for (int y = 1; y <= m; y++)
{
cin >> C[i][y];
}
}
for (int i = 1; i <= n; i++)
{
for (int y = 1; y <= m; y++)
{
D[i][y] = D[i-1][y] + D[i][y-1] - D[i-1][y-1];
int st=0;
if (C[i][y] == 'R')
{
if (m-y >= 2 && C[i][y+1] == 'G' && C[i][y+2] == 'W')
{
st = 1;
}
if (m-i >= 2 && C[i+1][y] == 'G' && C[i+2][y] == 'W')
{
st = 1;
}
}
D[i][y] += st;
M = max(M, D[i][y]);
}
}
cout << M;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |