Submission #637119

#TimeUsernameProblemLanguageResultExecution timeMemory
637119Ronin13Dango Maker (JOI18_dango_maker)C++14
13 / 100
1 ms304 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...