/*
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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
372 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
372 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
364 KB |
Output is correct |
2 |
Correct |
1 ms |
364 KB |
Output is correct |
3 |
Correct |
1 ms |
372 KB |
Output is correct |
4 |
Correct |
1 ms |
364 KB |
Output is correct |
5 |
Correct |
1 ms |
364 KB |
Output is correct |
6 |
Incorrect |
1 ms |
364 KB |
Output isn't correct |
7 |
Halted |
0 ms |
0 KB |
- |