이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
using namespace std;
#define ll long long
#define MIN(a, b) (((a) < (b)) ? (a) : (b))
#define MAX(a, b) (((a) < (b)) ? (b) : (a))
int const nmax = 3000;
char v[5 + nmax][5 + nmax];
int main()
{
int n, m;
cin >> n >> m;
for(int i = 1;i <= n; i++)
for(int j = 1;j <= m; j++)
cin >> v[i][j];
int result = 0;
for(int i = 1;i <= n; i++)
for(int j = 1; j <= m; j++) {
if(v[i][j] == 'R' && v[i][j + 1] == 'G' && v[i][j + 2] == 'W') {
result++;
v[i][j] = v[i][j + 1] = v[i][j + 2] = 0;
}
if(v[i][j] == 'R' && v[i + 1][j] == 'G' && v[i + 2][j] == 'W'){
result++;
v[i][j] = v[i + 1][j] = v[i + 2][j] = 0;
}
}
cout << result;
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... |