Submission #1276530

#TimeUsernameProblemLanguageResultExecution timeMemory
1276530tm.khoa.tmDango Maker (JOI18_dango_maker)C++20
0 / 100
341 ms9288 KiB
//I love ManchesterUnited
#include<bits/stdc++.h>
using namespace std;

#define love ManchesterUnited
#define int long long
#define pb push_back
#define FOR(i,a,b) for (int i=(a); i<=(b); i++)
#define FORD(i,b,a) for (int i=(b); i>=(a); i--)
#define REP(i, n) for(int i=0; i<(n); ++i)
#define RED(i, n) for(int i=(n)-1; i>=0; --i)
#define ALL(a) (a).begin(),(a).end()
#define ii  pair<int,int>
#define iii pair<int,ii>
#define fi first
#define se second
#define endl '\n'
#define MASK(x) (1 << (x))
#define BIT(mask,i) ((mask >> i) & 1)
typedef long long ll;

template<class X, class Y>
    bool minimize(X &x, const Y &y) {
        if (x > y) {
            x = y;
            return true;
        } else return false;
    }
template<class X, class Y>
    bool maximize(X &x, const Y &y) {
        if (x < y) {
            x = y;
            return true;
        } else return false;
    }
template<class T>
    T Abs(const T &x) {
        return (x < 0 ? -x : x);
    }

//___________________________________________________________________________________________________________________________________________________________
// CODE:

mt19937 rd(time(0) );

int Rand(int l,int r){
    return l + rand() % (r - l + 1);
}

const int N = 3005;
const int MOD = 1e9 + 7;
int n,m;
char a[N][N];
bool cnt[N][N];

int32_t main()
{
//    freopen("test.inp","r",stdin);
//    freopen("test.out","w",stdout);
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cin >> n >> m;
    FOR(i,1,n) FOR(j,1,m) cin >> a[i][j];

    vector <ii> vec;
    int res = 0;
    FOR(tc,1,1000){
        int ans = 0;
        memset(cnt,0,sizeof cnt);
        FOR(i,1,n) FOR(j,1,m) {
            if (a[i][j] == 'R') {
                int ok = Rand(0,1);
                if (ok) {
                    if (a[i][j + 1] == 'G' && a[i][j + 2] == 'W' && !cnt[i][j + 1] && !cnt[i][j + 2]){
                        ans++;
                        cnt[i][j + 2] = 1; cnt[i][j + 1] = 1;
                    }
                    if (a[i + 1][j] == 'G' && a[i + 2][j] == 'W' && !cnt[i + 1][j] && !cnt[i + 2][j]){
                        ans++;
                        cnt[i + 1][j] = 1; cnt[i + 2][j] = 1;
                    }
                } else {
                    if (a[i + 1][j] == 'G' && a[i + 2][j] == 'W' && !cnt[i + 1][j] && !cnt[i + 2][j]){
                        ans++;
                        cnt[i + 1][j] = 1; cnt[i + 2][j] = 1;
                    }
                    if (a[i][j + 1] == 'G' && a[i][j + 2] == 'W' && !cnt[i][j + 1] && !cnt[i][j + 2]){
                        ans++;
                        cnt[i][j + 2] = 1; cnt[i][j + 1] = 1;
                    }
                }
            }
        }
        res = max(res,ans);
    }

    cout << res << endl;
}


#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...