Submission #1341705

#TimeUsernameProblemLanguageResultExecution timeMemory
1341705NipphitchDango Maker (JOI18_dango_maker)C++20
0 / 100
5 ms344 KiB
#include <bits/stdc++.h>
using namespace std;
const int N=3005;

int n,m,ans;
bool b[N][N];
char c[N][N];

signed main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cin >> n >> m;
    for(int i=0;i<n;i++) for(int j=0;j<m;j++) cin >> c[i][j];
    for(int o=0;o<(1<<(n*m));o++){
        //memset(b,false,sizeof(b));
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if((o>>(i*m+j))&1){
                    b[i][j]=true;
                }
                else b[i][j]=false;
            }
        }
        int cnt=0;
        for(int i=0;i<n;i++){
            for(int j=0;j<m;j++){
                if(i>=2){
                    if(b[i][j] && b[i-1][j] && b[i-2][j]){
                        if(c[i][j]=='W' && c[i-1][j]=='G' && c[i-2][j]=='R'){
                            cnt++;
                            b[i][j]=b[i-1][j]=b[i-2][j]=true;
                        }
                    }
                }
                if(j>=2){
                    if(b[i][j] && b[i][j-1] && b[i][j-2]){
                        if(c[i][j]=='W' && c[i][j-1]=='G' && c[i][j-2]=='R'){
                            cnt++;
                            b[i][j]=b[i][j-1]=b[i][j-2]=true;
                        }
                    }
                }
            }
        }
        ans=max(ans,cnt);
    }
    cout << ans;
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...