#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, m;
cin >> n >> m;
char dum[n][m];
for(int i = 0; i < n; ++i)
{
string s;
cin >> s;
for(int j = 0; j < m; ++j)
dum[i][j] = s[j];
}
int odp = 0;
for(int i = 0; i < n; ++i)
for(int j = 0; 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 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
12 |
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 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
12 |
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 |
Correct |
1 ms |
336 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Incorrect |
1 ms |
336 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |