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