Submission #1352738

#TimeUsernameProblemLanguageResultExecution timeMemory
1352738gdshirpelengDango Maker (JOI18_dango_maker)C++20
0 / 100
0 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
#define in insert
#define pb push_back
#define pll pair<ll,ll>

ll n;
ll m;

bool To_The_Right(vector<vector<char>>&v,ll i,ll j){
    if(v[i][j]=='R' && v[i][j+1]=='G' && v[i][j+2]=='W'){
        return 1;
    }
    return 0;
}
bool To_The_Bottom(vector<vector<char>>&v,ll i,ll j){
    if(v[i][j]=='R' && v[i+1][j]=='G' && v[i+2][j]=='W'){
        return 1;
    }
    return 0;
}
void solve(){
    cin>>n>>m;
    vector<vector<char>>v(n+5,vector<char>(m+5,'.'));
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            cin>>v[i][j];
        }
    }
    ll ans=0;
    for(int i=1;i<=n;i++){
        for(int j=1;j<=m;j++){
            if(v[i][j]!='R'){
                continue;
            }
            if(To_The_Bottom(v,i,j) || To_The_Right(v,i,j)){
                ans++;
            }
        }
    }
    cout<<ans;
}

int main(){
    solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...