This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define ff first
#define ss second
#define double long double
const int N=3e3+5;
char arr[N][N];
signed main(){
int n,m;
cin>>n>>m;
int cnt=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>arr[i][j];
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m-2;j++){
if(arr[i][j]=='R' and arr[i][j+1]=='G' and arr[i][j+2]=='W' ){
cnt++;
arr[i][j]='X';
arr[i][j+1]='X';
arr[i][j+2]='X';
}
}
}
for(int j=1;j<=m;j++){
for(int i=1;i<=n-2;i++){
if(arr[i][j]=='R' and arr[i+1][j]=='G' and arr[i+2][j]=='W' ){
cnt++;
arr[i][j]='X';
arr[i+1][j]='X';
arr[i+2][j]='X';
}
}
}
cout<<cnt;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |