Submission #86295

#TimeUsernameProblemLanguageResultExecution timeMemory
86295updown1Dango Maker (JOI18_dango_maker)C++17
13 / 100
3 ms816 KiB
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, M)
#define ffa ffi ffj
#define s <<" "<<
#define c <<" : "<<
#define w cout
#define e endl // "/n"
#define pb push_back
#define mp make_pair
#define a first
#define b second
#define int ll
//500,000,000 operations
const int MAXN = 3000, INF = 100000000000000;
//Global Variables
int N, M, out;
bool used[MAXN][MAXN];
string grid[MAXN];

main() {
    //ifstream cin("test.in");
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin >> N >> M;
    ffa cin >> grid[i][j];
    For (i, 0, max(N, M)) {
        if (i < N) {
            /// check the ith row
            For (j, 0, M-2) if (!used[i][j] && !used[i][j+1] && !used[i][j+2] && grid[i][j] == 'R' && grid[i][j+1] == 'G' && grid[i][j+2] == 'W') {
                used[i][j] = used[i][j+1] = used[i][j+2] = true;
                out++;
            }
        }
        if (i < M) {
            /// check the ith col
            For (j, 0, N-2) if (!used[j][i] && !used[j+1][i] && !used[j+2][i] && grid[j][i] == 'R' && grid[j+1][i] == 'G' && grid[j+2][i] == 'W') {
                used[j][i] = used[j+1][i] = used[j+2][i] = true;
                out++;
            }
        }
    }
    w<< out<<e;
}

Compilation message (stderr)

dango_maker.cpp:24:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main() {
      ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...