이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pb push_back
#define pob pop_back
#define pf push_front
#define pof pop_front
#define pii pair<int, int>
#define pll pair<ll, ll>
#define ld long double
#define fastio ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define elif else if
#define x first
#define y second
ll n, m, ans;
char dango[3001][3001];
bool vis[3001][3001];
int main(){
cin >> n >> m;
for(int i=1; i<=n; i++){
for(int j=1; j<=m; j++){
cin >> dango[i][j];
}
}
for(int i=1; i<=n; i++){
for(int j=1; j<=m-2; j++){
if(vis[i][j])continue;
if(vis[i][j+1])continue;
if(vis[i][j+2])continue;
if(dango[i][j]=='R' && dango[i][j+1]=='G' && dango[i][j+2]=='W'){
ans++;
vis[i][j]=true;
vis[i][j+1]=true;
vis[i][j+2]=true;
}
}
}
for(int i=1; i<=m; i++){
for(int j=1; j<=n-2; j++){
if(vis[j][i])continue;
if(vis[j+1][i])continue;
if(vis[j+2][i])continue;
if(dango[j][i]=='R' && dango[j+1][i]=='G' && dango[j+2][i]=='W'){
ans++;
vis[j][i]=true;
vis[j+1][i]=true;
vis[j+2][i]=true;
}
}
}
cout << ans << endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |