이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <iostream>
#include <vector>
using namespace std;
bool odw[3001][3001];
int main()
{
int n,m;
cin >> n >> m;
int wyn=0;
vector<string> v(n);
for (int i=0; i<n; i++) cin >> v[i];
for (int i=0; i<n; i++){
for (int j=0; j<m; j++){
if (v[i][j]=='G' and v[max(i-1,0)][j]=='R' and v[min(i+1,n-1)][j]=='W' and v[i][max(j-1,0)]=='R' and v[i][min(j+1,m-1)]=='W' and !odw[i][j] and !odw[max(i-1,0)][j] and !odw[min(i+1,n-1)][j] and !odw[i][max(j-1,0)] and !odw[i][min(j+1,m-1)]){
odw[i][j]=odw[i+1][j]=odw[i][j+1]=1;
wyn++;
}
else if (v[i][j]=='G' and v[i][max(j-1,0)]=='R' and v[i][min(j+1,m-1)]=='W' and !odw[i][j] and !odw[i][max(j-1,0)] and !odw[i][min(j+1,m-1)]){
odw[i][j]=odw[i][j-1]=odw[i][j+1]=1;
wyn++;
}
else if (v[i][j]=='G' and v[max(i-1,0)][j]=='R' and v[min(i+1,m-1)][j]=='W' and !odw[i][j] and !odw[max(i-1,0)][j] and !odw[min(i+1,m-1)][j]){
odw[i][j]=odw[i-1][j]=odw[i+1][j]=1;
wyn++;
}
}
}
cout << wyn;
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... |