Submission #1289599

#TimeUsernameProblemLanguageResultExecution timeMemory
1289599bilgetux38Dango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms576 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'

int32_t main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    int n, m, ynt = 0;
    cin>>n>>m;
    vector<string> vec(n);
    vector<vector<int>> bob(n,vector<int>(m));
    for (int i = 0; i < n; ++i)
    {
        cin>>vec[i];
        
    }
    if (n > 2)
    {
        for (int i = 0; i < n-2; ++i)
        {
            for (int j = 0; j < m; ++j)
            {
                if (vec[i][j] == 'R' && vec[i+1][j] == 'G' && vec[i+2][j] == 'W' &&
                    bob[i][j] == 0   && bob[i+1][j] == 0   && bob[i+2][j] == 0)
                {
                    ++ynt;
                    bob[i][j] = 1;
                    bob[i+1][j] = 1;
                    bob[i+2][j] = 1;
                }
                
            } 
            
        }
        
    }
    if (m > 2)
    {
        for (int i = 0; i < n; ++i)
        {
            for (int j = 0; j < m-2; ++j)
            {
                if (vec[i][j] == 'R' && vec[i][j+1] == 'G' && vec[i][j+2] == 'W' &&
                    bob[i][j] == 0   && bob[i][j+1] == 0   && bob[i][j+2] == 0)
                {
                    ++ynt;
                    bob[i][j] = 1;
                    bob[i][j+1] = 1;
                    bob[i][j+2] = 1;
                }
                
            } 
            
        }   
        
    }
    
    cout<<ynt<<endl;
    
    
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...