이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
// author: Movlan
#define ll long long
//#define int long long
#define br "\n"
#define sp " "
#define pb push_back
#define pf push_front
typedef pair<ll,int> pii;
#define vi vector<int>;
#define vpii vector<pair<int,int>>
#define all(x) x.begin(),x.end()
#define sync ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
struct edge{
//int u;
int v;
ll w;bool operator<(edge const& other){return w<other.w;}
};
const int INF=1e9+7,MAXN=100007;
void solve(){
int n,m;
cin>>n>>m;
string arr[n];
for(int i=0;i<n;i++){
cin>>arr[i];
}
int res=0;
for(int i=0;i<n;i++){
for(int j=0;j<m;j++){
if(j<m-1 &&(arr[i][j]=='R' && arr[i][j+1]=='G' && arr[i][j+2]=='W')){
res++;
arr[i][j]='A';
arr[i][j+1]='A';
arr[i][j+2]='A';
}
if(i<n-1 &&(arr[i][j]=='R' && arr[i+1][j]=='G' && arr[i+2][j]=='W')){
res++;
arr[i][j]='A';
arr[i+1][j]='A';
arr[i+2][j]='A';
}
}
}
cout<<res;
}
signed main(){
sync;
int t=1;
//cin>>t;
while(t--){
solve();
}
}
/**
Get up and work hard.
There are only a few days left until the final round.
You need to win a medal for everything:
for the days you cried,
for the days you couldn't afford to attend an event,
for the days when the one you loved the most left you,
and for the days when you were at your lowest point with no friends.
Show them what a "cheater" can achieve.
Show them what a true ghost can do.
You've done this many times before.
One more time, and you're good to go.
O N L Y T H E D E A D S E E
**/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |