이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned ll
#define f first
#define s second
#define pii pair<int,int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
using namespace std;
int main(){
int n, m; cin >> n >> m;
char c[n + 1][m + 1];
bool used[n + 1][m + 1];
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
used[i][j] = false;
cin >> c[i][j];
}
}
int cnt = 0;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
if(c[i][j] == 'W'){
if(i > 2){
if(c[i - 1][j] == 'G' && c[i - 2][j] == 'R' && !used[i - 1][j] && !used[i - 2][j])
cnt++, used[i][j] = used[i - 1][j] = used[i - 2][j] = true;
}
if(!used[i][j]){
if(j > 2){
if(c[i][j - 1] == 'G' && c[i][j - 2] == 'R')
used[i][j - 1] = used[i][j - 2] = used[i][j] = true, cnt++;
}
}
}
}
}
cout << cnt << "\n";
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... |