Submission #678530

#TimeUsernameProblemLanguageResultExecution timeMemory
678530vjudge1Dango Maker (JOI18_dango_maker)C++17
13 / 100
1 ms340 KiB
#include<bits/stdc++.h>
using namespace std;

#define f first
#define s second

typedef long long ll;
typedef long double ld;
typedef pair<int, pair<int, int>> ft;

const ld PI = acos(-1);
const int maxn = 3e3+5;
const ll inf = 1e18;
const int mod = 998244353;

int n, m;

ll ans = 0, mx = -inf;

char board[maxn][maxn];

signed main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    cin >> n >> m;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++)cin >> board[i][j];
    }
    int ans = 0;
    for(int i = 0; i < n; i++){
        for(int j = 0; j < m; j++){
            if(j+2 < m && board[i][j] == 'R' && board[i][j+1] == 'G' && board[i][j+2] == 'W'){
                ans++;
                board[i][j] = '.';
                board[i][j+1] = '.';
                board[i][j+2] = '.';
            }
            if(i+2 < n && board[i][j] == 'R' && board[i+1][j] == 'G' && board[i+2][j] == 'W'){
                ans++;
                board[i][j] = '.';
                board[i+1][j] = '.';
                board[i+2][j] = '.';
            }
        }
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...