제출 #1289591

#제출 시각아이디문제언어결과실행 시간메모리
1289591faruk2012ekDango Maker (JOI18_dango_maker)C++20
13 / 100
1 ms584 KiB
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define sp <<" "<<
int inf = 2e18;

void solve()
{
    int n,m;
    cin >> n >> m;
    char dizi[n][m];
    for(int i=0;i<n;i++)for(int j=0;j<m;j++)cin >> dizi[i][j];
    int semboller = 0;
    for(int i=0;i<n;i++)
    {
        for(int j=0;j<m;j++)
        {
            if(j+2 < m && dizi[i][j]=='R' && dizi[i][j+1]=='G' && dizi[i][j+2]=='W')
            {
                if(dizi[i][j]!='0' && dizi[i][j+1]!='0' && dizi[i][j+2]!='0')
                {
                    semboller++;
                    dizi[i][j] = dizi[i][j+1] = dizi[i][j+2] = '0'; 
                }
            }
            if(i+2 < n && dizi[i][j]=='R' && dizi[i+1][j]=='G' && dizi[i+2][j]=='W')
            {
                if(dizi[i][j]!='0' && dizi[i+1][j]!='0' && dizi[i+2][j]!='0')
                {
                    semboller++;
                    dizi[i][j] = dizi[i+1][j] = dizi[i+2][j] = '0';
                }
            }
        }
    }

    cout << semboller;
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);

#ifdef faruk
    freopen("in.txt", "r", stdin);
    freopen("out.txt", "w", stdout);
#endif

    int t = 1;
    //cin>>t;
    while (t--) solve();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...